Microsoft KB Archive/832118

= Unexpected behavior when you use OLE objects in the Document Actions task pane for a Smart Document solution in Microsoft Office Excel or in Microsoft Office Word =

Article ID: 832118

Article Last Modified on 3/30/2007

-

APPLIES TO


 * Microsoft Office Word 2007
 * Microsoft Office Excel 2007
 * Microsoft Office Word 2003
 * Microsoft Office Excel 2003

-





Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry



SYMPTOMS
If you try to use an OLE object as an ActiveX control in the Document Actions task pane for a Smart Document solution, you may experience unexpected behavior.



CAUSE
This behavior occurs because the use of OLE objects in the Document Actions task pane is not supported. Examples of OLE objects include embedded Microsoft Office Excel 2007 or Microsoft Office Excel 2003 worksheets, embedded Microsoft Office Word 2007 or Microsoft Office Word 2003 documents, and Microsoft Graph charts.



STATUS
This behavior is by design.



RESOLUTION
To include functionality that is provided by an OLE object in the Document Actions task pane, use a type of control that provides similar functionality, such as an ActiveX control or a native control.

Following are two examples of how you can use an ActiveX control instead of using the embedding technique:
 * To add charting functionality to your Smart Document, use an ActiveX control from the Microsoft Office Web Component chart, instead of embedding a Graph chart.
 * To add spreadsheet functionality to your Smart Document, use an ActiveX control from the Microsoft Office Web Component spreadsheet, instead of embedding an Excel 2007 or Excel 200 worksheet.



MORE INFORMATION
Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Steps to reproduce the problem
Note The following steps use information and files that are installed with the Microsoft Office 2003 Smart Document software development kit (SDK). The following steps work correctly only when the SDK is installed. To download and to install the SDK, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=24a557f7-eb06-4a2c-8f6c-2767b174126f&DisplayLang=en

 To create the Smart Document DLL, follow these steps:  Start Microsoft Visual Basic 6.0. On the File menu, click New Project. In the New Project dialog box, click ActiveX DLL, and then click OK. Type SDGraph for the Project Name.</li>  In the Class Module window, add the following code: Implements ISmartDocument

'CONSTANTS 'You must have one constant for the schema namespace, one constant for each 'schema element that you want to provide smart document controls for 'and actions for, and one constant for the total number of schema elements 'that have associated actions.

'Because XML is case sensitive, the values 'of these constants must be exact both in spelling and in case. 'Therefore, if the textBox element is spelled with a 'capital B in the XML schema, you must assign the 'value of the cTEXTBOX constant as &quot;cNAMESPACE & #textBox&quot;.

'Namespace constant Const cNAMESPACE As String = &quot;urn:schemas-xml-office:SDGraph&quot;

'Element constants Const cActiveX As String = cNAMESPACE & &quot;#SDActiveX&quot;

'Number of types (or element constants) Const cTYPES As Integer = 1

'Constants Private strPath As String Private strApp As String

Private Sub ISmartDocument_SmartDocInitialize(ByVal ApplicationName As String, ByVal Document As Object, ByVal SolutionPath As String, ByVal SolutionRegKeyRoot As String)

strPath = Document.Path & &quot;\&quot; strApp = Document.Application.Name

End Sub

Private Property Get ISmartDocument_SmartDocXmlTypeCount As Long ISmartDocument_SmartDocXmlTypeCount = cTYPES End Property

Private Property Get ISmartDocument_SmartDocXmlTypeName( _       ByVal XMLTypeID As Long) As String

Select Case XMLTypeID Case 1 ISmartDocument_SmartDocXmlTypeName = cActiveX Case Else

End Select End Property

Private Property Get ISmartDocument_SmartDocXmlTypeCaption( _       ByVal XMLTypeID As Long, ByVal LocaleID As Long) As String Select Case XMLTypeID Case 1 ISmartDocument_SmartDocXmlTypeCaption = &quot;Microsoft Graph&quot; Case Else End Select End Property

Private Property Get ISmartDocument_ControlCount( _       ByVal XMLTypeName As String) As Long Select Case XMLTypeName Case cActiveX ISmartDocument_ControlCount = 1 Case Else End Select End Property

'The ControlID for the first control that you add is 1. 'For more information about how to specify the ControlID, see the ControlID reference 'topic in the References section of this SDK. Private Property Get ISmartDocument_ControlID( _       ByVal XMLTypeName As String, _        ByVal ControlIndex As Long) As Long Select Case XMLTypeName Case cActiveX ISmartDocument_ControlID = ControlIndex Case Else End Select End Property

Private Property Get ISmartDocument_ControlNameFromID( _       ByVal ControlID As Long) As String 'This subroutine is intentionally left empty. End Property

Private Property Get ISmartDocument_ControlCaptionFromID( _       ByVal ControlID As Long, ByVal ApplicationName As String, _        ByVal LocaleID As Long, ByVal Text As String, _        ByVal Xml As String, ByVal Target As Object) As String Select Case ControlID Case 1 ISmartDocument_ControlCaptionFromID = &quot;Microsoft Graph&quot; ISmartDocument_ControlCaptionFromID = &quot;{00020803-0000-0000-C000-000000000046}&quot; ' MSGraph.Chart 'ISmartDocument_ControlCaptionFromID = &quot;{0002E55D-0000-0000-C000-000000000046}&quot; 'OWC11 Chart Case Else End Select End Property

Private Property Get ISmartDocument_ControlTypeFromID( _       ByVal ControlID As Long, _        ByVal ApplicationName As String, _        ByVal LocaleID As Long) As SmartTagLib.C_TYPE

Select Case ControlID Case 1 ISmartDocument_ControlTypeFromID = C_TYPE_ACTIVEX Case Else End Select End Property

Private Sub ISmartDocument_PopulateActiveXProps(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, ByVal ActiveXPropBag As SmartTagLib.ISmartDocProperties) Dim ControlIndex As Integer ControlIndex = 0 If ControlID = 1 Then Select Case ControlIndex Case 0 Props.Write &quot;X&quot;, &quot;5&quot; Props.Write &quot;Y&quot;, &quot;0&quot; Props.Write &quot;H&quot;, &quot;180&quot; Props.Write &quot;W&quot;, &quot;180&quot; End Select End If End Sub

Private Sub ISmartDocument_PopulateCheckbox(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, Checked As Boolean)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateDocumentFragment(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, DocumentFragment As String)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateHelpContent(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, Content As String)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateImage(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, ImageSrc As String)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateListOrComboContent(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, List As String, count As Long, InitialSelected As Long) 'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateOther(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties) 'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateRadioGroup(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, List As String, count As Long, InitialSelected As Long) 'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_PopulateTextboxContent( _       ByVal ControlID As Long, ByVal ApplicationName As String, _        ByVal LocaleID As Long, ByVal Text As String, _        ByVal Xml As String, ByVal Target As Object, _        ByVal Props As SmartTagLib.ISmartDocProperties, Value As String)

'This subroutine is intentionally left empty.

End Sub

Private Sub ISmartDocument_ImageClick(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long, ByVal XCoordinate As Long, ByVal YCoordinate As Long)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_InvokeControl(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_OnCheckboxChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Checked As Boolean)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_OnListOrComboSelectChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Selected As Long, ByVal Value As String)

'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_OnRadioGroupSelectChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Selected As Long, ByVal Value As String)

'This subroutine is intentionally left empty. End Sub

'After you enter something in the text box, 'the SimpleSample smart document displays a message that says &quot;Hello&quot;. Private Sub ISmartDocument_OnTextboxContentChange( _       ByVal ControlID As Long, ByVal Target As Object, _        ByVal Value As String) 'This subroutine is intentionally left empty. End Sub

Private Sub ISmartDocument_OnPaneUpdateComplete(ByVal Document As Object)

'This subroutine is intentionally left empty. End Sub </li> On the Project menu, click References, select Microsoft Word 11.0 Object Library or Microsoft Word 12.0 Object Library, select Microsoft Smart Tags 2.0 Type Library, and then click OK.</li> On the File menu, select Make SDGraph.dll to build the Smart Document DLL.</li></ol> </li> To create the manifest file, follow these steps: <ol style="list-style-type: lower-alpha;">  Open a text editor such as Notepad. Paste the following code in a blank document: <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?> <manifest xmlns=&quot;http://schemas.microsoft.com/office/xmlexpansionpacks/2003&quot;> urn:schemas-xml-office:SDGraph 1.0    SDGraphManifest.xml <updateFrequency>10000</updateFrequency> <solutionID>SDGraph</solutionID> SDGraph Schema schema schema 1.0            <filePath>SDGraph.xsd</filePath> <solutionID>SDGraph</solutionID> SDGraph Solution 02 SmartDocument SolutionActionHandler 1.0            <filePath>SDGraph.dll</filePath> <CLSID><Enter CLSID of Smart Document dll></CLSID> </li> Start Regedit.exe.</li> Expand the  hive, and then locate the   key.</li> Expand the  key, and then select the   subkey.</li> Copy the GUID for the CLSID. Replace the occurrence of <Enter CLSID of Smart Document dll> in the code with the GUID of the DLL.</li> Save the file as SDGraphManifest.xml, and then close the file.</li></ol> </li> To create the schema file, follow these steps: <ol style="list-style-type: lower-alpha;">  Open a text editor such as Notepad. Paste the following code in a blank document: <xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns=&quot;urn:schemas-xml-office:SDGraph&quot; targetNamespace=&quot;urn:schemas-xml-office:SDGraph&quot; elementFormDefault=&quot;qualified&quot; attributeFormDefault=&quot;qualified&quot;>

<xsd:complexType name=&quot;SDGraph&quot;> <xsd:all> <xsd:element name=&quot;SDActiveX&quot; type=&quot;xsd:string&quot;/> </xsd:all> </xsd:complexType> <xsd:element name=&quot;SDGraph&quot; type=&quot;SDGraph&quot;/> </xsd:schema> </li> Save the file as SDGraph.xsd, and then close the file.</li></ol> </li> To test the Smart Document, follow these steps: <ol style="list-style-type: lower-alpha;"> The DisableManifestSecurityCheck.reg file is installed by the Office 2003 Smart Document SDK. To add the registry key that disables the manifest security check, locate, and then double-click the key.</li> <li>Start Word.</li> <li>Word 2007

On the Developer tab, click Expansion Pack, and then click Add

Word 2003

On the Tools menu, click Templates and Add-ins.</li> <li>In the Templates and Add-ins dialog box, click the XML Expansion Packs tab, and then click Add.</li> <li>In the Install XML Expansion Pack dialog box, locate the SDGraphManifest.xml file. Select the SDGraphManifest.xml file, and then click Open.

Note If you receive a prompt to re-enable XML expansion pack security, click No.</li> <li>Click OK to close the Templates and Add-ins dialog box after the installation is completed.</li> <li>Word 2007

On the Developer tab, click Structure.

Word 2003Click the Document Actions task pane title, and then click XML Structure.</li> <li>Make sure that the Show XML tags in the smart document check box is selected.</li> <li>Add the SDGraph element and the SDActiveX element to the document.</li> <li>Click the XML Structure task pane title, and then click Document Actions. Double-click the SDActiveX element in the document to start Graph.

An exception occurs.</li></ol> </li></ol>

Additional query words: WD2007

Keywords: kbprb kbofficesmartdoc KB832118

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.