XML Support in Office System 2003


A key highlight of the Professional Edition of Office 2003 is the extensive support for Extensible Markup Language (XML). Essentially, the Professional Edition allows Office documents such as Word and Excel to be exported and bound to XML documents. The XML can be either tagged with Microsoft's own schema, or individual components of the Office document can be bound to specific XML Schema elements. In addition to XML support in standard Office applications, particularly Word, Excel, and Access, InfoPath 2003 (a new application available either as a standalone application or as part of the Office Professional Enterprise License), provides extensive support for XML and Web services. Apart from InfoPath, XML support exists primarily for Word, Excel, and Access applications.

For instance, suppose you have an Order XML Schema (see Listing 12.1). The Schema contains a header-level XML element that, in turn , contains the customer name and the purchase order number. Next in the document are the order details, which contain a list of line items, individually containing a line number, item, price, and quantity. This Schema can be developed itself through Visual Studio .NET 2003 (as shown in Figure 12.1) or can be written by hand, based on your preference.

Listing 12.1 A Simple Order XML Schema
 <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"   targetNamespace="http://www.mycompany.com/bods"   xmlns="http://www.mycompany.com/bods"> <xs:element name="order">       <xs:complexType>             <xs:sequence>                  <xs:element ref="header"/>                  <xs:element ref="lines"/>            </xs:sequence>      </xs:complexType> </xs:element> <xs:element name="header">      <xs:complexType>            <xs:sequence>                  <xs:element ref="customer"/>                  <xs:element ref="po"/>            </xs:sequence>     </xs:complexType> </xs:element> <xs:element name="customer" type="xs:string"/> <xs:element name="po" type="xs:int"/> <xs:element name="lines">       <xs:complexType>            <xs:sequence>                      <xs:element ref="line" minOccurs="0"                                  maxOccurs="unbounded"/>            </xs:sequence>       </xs:complexType> </xs:element> <xs:element name="line">       <xs:complexType>            <xs:sequence>                  <xs:element ref="no"/>                  <xs:element ref="item"/>                  <xs:element ref="price"/>                  <xs:element ref="qty"/>             </xs:sequence>       </xs:complexType> </xs:element> <xs:element name="no" type="xs:int"/> <xs:element name="item" type="xs:string"/> <xs:element name="price" type="xs:float"/> <xs:element name="qty" type="xs:int"/> </xs:schema> 
Figure 12.1. Schema authoring in Visual Studio .NET.

After the Schema has been authored , Word 2003 allows a Word document to be bound to elements of the XML Schema, by using the new XML Structure toolbar shown in Figure 12.2. An XML Schema can be referenced in a Word document using Tools, Templates and Add-ins. The toolbar provides element “by-element mapping of the content stored in the Word document template. As expected, Word follows the various XML Schema “ related structural validations so that document authors can be easily validated .

Figure 12.2. XML support in Word 2003.

After the document has been authored in Word, it can then be stored on a file system or submitted to an application in two ways: either as a WordXML representation, which includes the XML content and the necessary layout and user interface of the Word document itself, or just the data aspect. For instance, Listing 12.2 is the XML data represented by the Word document authored earlier.

Listing 12.2 Order XML Data
 <?xml version="1.0" encoding="UTF-8" standalone="no"?> <order xmlns="http://www.mycompany.com/bods"> <header>       <customer>ABC Chemicals</customer>       <po>3456</po> </header> <lines>       <line>              <no>1</no>              <item>ABC345</item>              <price>400</price>              <qty>40</qty>      </line>         ... </lines> </order> 

Similar to Word, Excel includes support for mapping individual cells and collections of cells of XML documents to Excel workbooks. In fact, Excel's support (shown in Figure 12.3) is in some ways superior to Word's because it allows better handling of repeated items (such as the line tag in the Order schema in Listing 12.1) and doesn't require line-by-line mapping. Also, a key reason for using Excel is to use its built-in analysis capabilities. For instance, the Excel worksheet shown next calculates the extended price of individual line items and the total price of the order through the built-in Excel mathematical functions. Items such as Charts and PivotTables can be included for better analysis.

Figure 12.3. XML Support in Excel 2003.

XML SUPPORT IN WORD AND EXCEL ”WHEN TO USE WHAT?

Both Excel and Word 2003 products have rich XML support. However, in my experience, XML support in Excel is better suited for applications that capture repeated data (such as orders that contain a set of line items). Of course, Excel spreadsheets also come in handy in these applications for discounts , total amount calculations, and so on. Use Word when you need the strong formatting support of text. InfoPath is definitely the right tool when rich electronic form-based data capture is required.


Digital Rights Management

A key problem in Information Technology is keeping intellectual property safe. Whereas enterprise data is safely stored and accessed through enterprise applications (through either off-the-shelf ERP/CRM packages or custom application development), much of a company's intellectual property resides in Office documents created by individuals, and these documents reside on their laptops and desktops and in file shares and emails. Sharing the information has meant simply copying a document from a remote location or including it as an email attachment, and the document is immediately available to you. Although this is very easy from the user's perspective, it introduces a key problem about how to secure a company's assets. Digital Rights Management, a technology introduced in Office 2003, allows authors of Office documents to control access to the document by other users. Users can select who should be able to access the document and what permissions those individuals or groups have. The information about the users is stored in an associated Digital Rights Management (DRM) server. To secure the document using DRM, the user selects that this particular document should use DRM and then enters or selects the users who should have access to the product and at what level, as shown in Figure 12.4.

Figure 12.4. Digital Rights Management support in Office 2003.



Microsoft.Net Kick Start
Microsoft .NET Kick Start
ISBN: 0672325748
EAN: 2147483647
Year: 2003
Pages: 195
Authors: Hitesh Seth

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net