|
Writing SmartDocument Managed Code
Just like you implemented ISmartDocument interface definitions in the VB6 Shim, implement the ISmartDocument interface in a new .NET class library project (the sample code uses VB.NET). Rename the project to "CustomerManagement" and the default class to "Customer.vb." In most cases, VB.NET is a better choice for Office 2003 programming, because of its similarity to VBA, which is the native language for Office-based applications.
Table 1 and Table 2 contain some important interface methods that you may need to implement. I've separated these into two sections, even though the interface documentation contains no such differentiation.
Table 1. SmartNodeInitalizers: Interface implementations that concern document and XmlType initialization.
| Method
|
Description
|
| SmartDocInitialize
|
As the name suggests, this is the document initializer. Any startup tasks should go in this method, which is executed once during the document initialization phase.
|
| SmartDocXmlTypeCount
|
You return the number of Smart Nodes (XMLTypes) that will be hooked up to the Document actions pane.
Note: I've termed XmlTypes as Smart Nodes because they are intelligent nodes of the document. Each such node brings in a portion of the total functionality of an intelligent document.
|
| SmartDocXmlTypeName
|
You will return the XMLTypeNamethe name of the node for a given XmlTypeID.
|
| SmartDocXmlTypeCaption
|
Specifies the caption in the document actions pane for a given XmlTypeID.
|
Table 2. Control handlers: These methods act as successors to the methods shown in Table 1, and control the content rendered in the Document actions pane for an associated smartNode or Xml Type.
| Method
|
Description
|
| ControlCount
|
Returns the number of controls associated with a specific XmlType.
|
| ControlNameFromID
|
Declares a name for the control with a given ControlID. You can later use this to actually get access to the controls.
|
| ControlTypeFromID
|
For a given ControlID you could say which control to render using a C_TYPE enum, for example, C_TYPE.C_TYPE_COMBO, C_TYPE.C_TYPE_BUTTON,
C_TYPE.C_TYPE_ACTIVEX, etc.
|
| OnPaneUpdateComplete
|
This is a finalize phase where you code for actions, after all the controls, etc are rendered/populated as required in the Document task pane.
|
| ControlCaptionFromID
|
Retrieve a caption for the specified control
|
| PopulateListOrComboContent
|
Whenever you specify a LISTBOX or COMBO in your task pane via the ControlTypeFromID method, this method is automatically hooked up and fires so you can populate the list.
|
| InvokeControl
|
This method fires when a user clicks a button, hyperlink, etc
|
| OnListOrComboSelectChange
|
This event occurs after any selection change for a ListBox or ComboBox.
|
Tables 1 and 2 are by no means comprehensive, but you can find a complete list here.
Now that you've seen the basic components involved in putting together a SmartDocument, you can begin working on the implementation phase.
|