Introduction to Planning Smart Documents [Office 2003 SDK Documentation]
The topics in this section can help you work through some of the important issues in the planning process for developing smart documents.
Smart document architecture
The internal smart document architecture for both Microsoft® Office Word 2003 and Microsoft Office Excel 2003 is relatively simple. If you attach an XML expansion pack to an XML document that uses the corresponding schema, you will create a smart document. For example, if you have a schema named Expense.xsd attached to an Excel worksheet and an XML expansion pack that contains a smart document component that uses Expense.xsd to create smart document actions, and you attach the manifest file to the worksheet, you create a smart document.
As simple as it sounds, a lot goes on behind the scenes to make the smart document happen. When a user opens a document that has an attached XML expansion pack, the host application checks the information contained in the document against the information contained in the user's Schema Library. If this information matches, the smart document opens with all functionality. If it doesn't match, which would likely happen on first use, the XML expansion pack manifest security starts. For more information about this internal architecture, see Architecture.
Selecting the host application
You can create a smart document that works in both Word and Excel; however, most smart documents you create will likely work in one application or the other. Therefore, important to your planning process is determining which application is the best host application for your smart document. For more information, see Working with XML in Word and Excel.
To help you determine the right application to use as your host application, you need to know the purpose of your smart document. Then you can determine whether you need the worksheet calculation support that Excel offers or the text formatting that Word offers. For example, if you are creating an expense reporting or an invoicing smart document, Excel is the better choice because calculating rows and columns is simpler in Excel. However, if you need to create an employee review smart document that contains large amounts of text, Word is the obvious choice.
You should also consider whether you need additional functionality included in the form of macros and add-ins. Both Excel and Word provide Visual Basic® for Applications (VBA) object models for macros and add-ins. You can include these in the form of macros within a Word or Excel template, or you can include them in separate dynamic-link library (DLL) files that are installed as add-ins to extend the functionality of the application.
Using databases with smart documents
Working with databases in smart documents is much the same as working with databases in any other application you might develop. You would use the appropriate Microsoft ActiveX® Data Objects (ADO) database connections and SQL queries that you would use in any other code. Just as you can change an application based on the selection of an item in a list or an entry in a text box, you can make your smart document controls change according to the data entered into another control. For example, if you have a combo box that provides a list of names from a database, you can populate other controls with relevant data from the database, based on the value of that control.
To do this effectively within a smart document, you need to maintain the state of the controls. For more information, see Maintaining the State of Smart Document Controls.
Understanding security and privacy
Within both a testing environment and a deployment environment, you should understand the security infrastructure for smart documents. Security information related to deployment scenarios is explained in detail in the Security section. For information about managing security in a testing environment, see Security During Testing.
Privacy is strongly related to security, and there are certain privacy issues to be aware of before you plan and develop your smart documents. You can find a detailed discussion of privacy-related issues in Privacy.
Programming smart documents
For smart documents that use Component Object Model (COM) technology, you can use Microsoft Visual Basic 6.0 or Microsoft Visual C++® 6.0. You can also create smart documents in any .NET Framework-compatible programming language. For more information, see Ways to Develop a Smart Document. This software development kit includes tutorials and samples written mostly in Microsoft Visual Basic .NET and in C#, but if you feel more comfortable with another language and that language has a .NET Framework compiler, you can easily write your smart document code in that language.
In addition, for very simple smart documents, you can use the Microsoft Office Smart Tag List (MOSTL) Schema. For more information, see Microsoft Office Smart Tag List Schema Overview.