1 / 14

Word Object Model / OpenXML

Brett Clouser. Word Object Model / OpenXML. OpenXML : What is it?. XML-based file format which describes documents, presentations, spreadsheets, etc. Replacement for binary file formats used in previous versions of Office. Why use OpenXML ?. Readable – plaintext representation

Download Presentation

Word Object Model / OpenXML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Brett Clouser Word Object Model / OpenXML

  2. OpenXML: What is it? • XML-based file format which describes documents, presentations, spreadsheets, etc. • Replacement for binary file formats used in previous versions of Office

  3. Why use OpenXML? • Readable – plaintext representation • Smaller - compressed as a ZIP archive • Straightforward - images are respresented within <pic> tags • All the benefits of regular XML!

  4. Docx Structure (Containers) • Paragraph <w:p> • Most basic unit • One for each line break in the document • Container element • Run <w:r> • Region of content with a common set of properties • All runs must be contained within a paragraph

  5. Docx Structure (Root Elements) • Text <w:t> • Basic block of text • Normal formatting can be applied through formatting tags (i.e. <w:b> for bold) • Must be contained within a run • Images <w:pic> • Pictures, Clipart, Smartart, Shapes, charts, etc. • Additional transformations can be applied to the base image (rotation, reflection, etc.)

  6. Docx Structure (example) This is bold text. <w:p> <w:r> <w:t>This is </w:t> </w:r> <w:r> <w:rPr><w:b /></w:pr> <w:t>bold </w:t> </w:r> <w:r> <w:t>text.</w:t> </w:r> </w:p>

  7. Dissecting a Word 2007 Document • Demo

  8. Working with OpenXML documents • Microsoft SDK for OpenXML • Provides strong bindings for accessing document parts • Allows developer to create or change documents without having Word open • Word Object Model • Coming up next…

  9. Office Plugins • Visual Studio Tools for Office (VSTO) • Add-on for Visual Studio 2005 • Develop Office add-ins just like any other application • Use WYSIWYG editor to create GUI • Access the document through the Word object model

  10. Word Object Model

  11. Word Object Model • InlineShapes • Collection of references to all images in the document • Paragraphs • Directly correspond to OpenXML <w:p> tags • Ranges • Contiguous area in document • Can access actual text of document through Text property

  12. Creating a plugin demo • Visual Studio Tools for Office Demo

  13. How we’re using it… • OpenXML SDK to parse the document/presentation for accessibility errors • VSTO SE to create an addin that checks accessibility • Word Object Model to highlight regions of text and manipulate the document

  14. Conclusions • Any questions?

More Related