Open XML SDK for Microsoft Office

Slides:



Advertisements
Similar presentations
Creating Accessible PDF Documents Dick Hemenway CMAC Accessibility Committee.
Advertisements

SharePoint 2010 Overview Presented by: Oscar Garcia
Organizing List and Documents with Site Columns and Content Types Gayan Peiris Principal Consultant
©2011 Quest Software, Inc. All rights reserved. Steve Walch, Senior Product Manager Blog: November, 2011 Partner Training Webcast.
Microsoft Office SharePoint Portal Server 2007 Introduction to InfoPath Forms Services Daryl L. Rudolph.
MS-Word XP Lesson 1.
Microsoft SharePoint 2010 technology for Developers
Microsoft Office System UK Developers Conference Radisson Edwardian, Heathrow 29 th & 30 th June 2005.
Using VB with MS Applications R. Juhl, Delta College.
Will
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Learn How to Create Word and Excel Documents.  John DeVight  Herndon, Virginia  Senior Principal Software Engineer at ManTech  Telerik MVP 
FINAL REVIEW Carley. Contents Unit A: Understanding Essential Computer Concepts Unit B: Getting Started wit Mac OS X Leopard Unit C: Understanding File.
Development of a visual studio plugin to visualize a Blocks-Graph
OFC 317 使用 WinWF 构建 Microsoft Office SharePoint Server 2007 中的工作流应用.
1 Computing for Todays Lecture 22 Yumei Huo Fall 2006.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California ArcGIS Explorer Desktop.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
The Sixth Form College Farnborough Microsoft® Office OpenXML Jim Lyle Data Analyst The Sixth Form College Farnborough Presented at the Sixth Form Colleges’
USER GUIDE TO OPEN OFFICE BY MARTIN ROCHE 11K. CONTENTS.
SharePoint Development 101: Feature Design By Becky Isserman
Old school way Microsoft Confidential New school way.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
® IBM Software Group © 2006 IBM Corporation Display contents of a Data Table in Excel right from the browser – No POI needed This section describes how.
OFC302 Building Smart Document Solutions in Word & Excel Martin Sawicki Lead Program Manager.
Introduction to VBA. What is VBA? VBA stands for Visual Basic for Applications. It is a programming language used exclusively by the Microsoft Office.
Microsoft ® Word Templates and Accessibility. 1 What is a Word template? File with a.dot (document template) extension Can define the following:  Paragraph.
OFC304 Excel 2003 Overview: XML Support Joseph Chirilov Program Manager.
For Version 6.0 and later Lattice3D Reporter Tutorial For Version 6.0 and later LATTICE TECHNOLOGY, INC.
MAIL MERGE Designing Documents with. Terms Mail Merge: A process that inserts variable information into a standardized document to produce a personalized.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Exploring Microsoft Office Word 2007 Chapter 8 Word and the Internet Robert Grauer, Keith.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Peoplesoft XML Publisher Integration with PeopleTools -Jayalakshmi S.
Scalable Game Development William Roberts Senior Game Engineer
© BJSS Limited 2005 Commercial in Confidence Visual Studio 2008 Productivity Enhancing Tips and Resources Jeff Watkins – 25 September 2008.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Slide 1.NET Development for Project 2003 Samples from the Project 2003 SDK Jim Corbin Programmer Writer Office Developer Documentation Microsoft Corporation.
Working with Templates Lesson 6. Skills Matrix SKILL #MATRIX SKILL 1.1.1Work with templates 1.1.6Insert blank pages or cover pages.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 13 Templates.
Using Xcode A Beginner’s Tutorial Erin Green. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications – We.
Office Business Applications Workshop Defining Business Process and Workflows.
OpenXML: What is it?  XML-based file format which describes documents, presentations, spreadsheets, etc.  Replacement for binary file formats used in.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Microsoft ® Office Excel 2003 Training Using XML in Excel SynAppSys Educational Services presents:
Computer Literacy for IC 3 Unit 2: Using Productivity Software Chapter 3: Formatting and Organizing Paragraphs and Documents © 2010 Pearson Education,
OFC291 Microsoft® Office Word XML (part 1 of 3): Introduction Martin Sawicki Lead Program Manager.
Power Point Introduction to Computers. Opening and Viewing Presentations Click on the Start button (bottom-left of your screen). From the popup menu displayed.
MICROSOFT WORD 2010 Lesson 6: Word Templates. The goal of this lesson is for the students to successfully create and work with templates. The student.
ADD-IN EXPRESS World-class Office extensions with little coding.
The File menu from Word 2003 has been replaced with the Microsoft Office Button. This button contains the basic commands such as Open, Save, Print,
Exploring Microsoft Microsoft FrontPage Chapter 21 Exploring Microsoft FrontPage 2002 Chapter 1 Creating a Home Page: Introduction to MS FrontPage.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
John R. Durant Senior Product Manager Microsoft Corporation SESSION CODE: OSP313.
Chapter 29. Copyright 2003, Paradigm Publishing Inc. CHAPTER 29 BACKNEXTEND 29-2 LINKS TO OBJECTIVES Attach an XML Schema Attach an XML Schema Load XML.
Getting Started with Oracle Berkeley DB 11gR2 and ADO.NET
XP Creating Web Pages with Microsoft Office
Windows App Studio Windows App Studio is the tool that makes it fast and easy to build Windows 10 apps. It’s accessible from any device with a browser.
EML 2023 – Modeling, Parts Lecture 1.1 –Configuring SolidWorks.
A Workshop on LibreOffice Er. Arvind Kumar Assistant Professor, Department of Computer Science & Engineering
Click Once installation
Data Visualizer.
Microsoft Dynamics.
Module 1: Getting Started
Microsoft PowerPoint 2007 – Unit 2
The SharePoint framework
Windows Forms in Visual Studio 2005: An in-depth look at key features
Windows Forms in Visual Studio 2005: An Overview
Contexualized Data In Document Authoring
Presentation transcript:

Open XML SDK for Microsoft Office John DeVight TechGate 2013 – Reston, VA September 21, 2013

Introductions John DeVight Herndon, Virginia Senior Principal Software Engineer at ManTech Telerik MVP John.DeVight@gmail.com

Agenda About the Open XML SDK Library (2 minutes) “Telerik Products” Demo (3 minutes) Getting Started (5 minutes) Installing the Open XML SDK Library Reference the Open XML SDK Library Open XML SDK 2.0 Productivity Tool Creating Word Documents (30 minutes) Using “Open XML SDK 2.0 Productivity Tool for MS Office” Using Bookmarks Using XSLT Creating Excel Documents (10 minutes) Using the SDK Directly Using SpreadsheetLight

About the Open XML SDK Library: What is it? “The Open XML SDK 2.0 simplifies the task of manipulating Open XML packages and the underlying Open XML schema elements within a package. The Open XML SDK 2.0 encapsulates many common tasks that developers perform on Open XML packages, so that you can perform complex operations with just a few lines of code.” 1 An Open XML Package is a zip file containing XML documents, images and other files needed to display the document in a Microsoft Office application. 1. http://msdn.microsoft.com/en-us/library/office/bb448854(v=office.14).aspx 50 min

“Telerik Products” Demo

Getting Started: Installing the Open XML SDK Library Open XML SDK 2.0 for Microsoft Office Download Install the “Open XML SDK” from the OpenXMLSDKv2.msi installer. Install the “Open XML SDK Productivity Tool for Microsoft Office” from the OpenXMLSDKTool.msi installer. 5 min 45 min

Getting Started: Reference the Open XML SDK Library In the .NET application, reference: * WordLite is a class library that I created to make it easier to work with Word Documents. ** SpreadsheetLight is freely available under the MIT License that simplifies using the Open XML SDK Library when creating Excel Documents. Assembly Visual Studio 2012 DocumentFormat.OpenXml Assemblies -> Extensions WindowsBase Assemblies -> Framework *WordLite Browse ** SpreadsheetLight

Getting Started: Open XML SDK 2.0 Productivity Tool Open Microsoft Office document and generate C# code to create the same document. View the Open XML SDK Documentation.

Creating Word Documents: Options Open XML SDK 2.0 Productivity Tool for MS Office Bookmarks XSLT 10 min 40 min

Creating Word Documents: Using “Open XML SDK 2.0 Productivity Tool” Pros All the code is generated for you. Fast and Easy. Cons The tool generates a lot of code. Every change requires the code to be updated and deployed.

Creating Word Documents: Using “Open XML SDK 2.0 Productivity Tool” Create and Save Word Document Open the Word Document using “Open XML SDK 2.0 Productivity Tool” In “Document Explorer”, right-click on root and select “Reflect Code”. Create console app in Visual Studio. Add references to required assemblies. Create new class for the “generated code”. Instantiate class and call CreatePackage from Main.

Create Word Documents: Using Bookmarks Pros Easy to create and update the “template” document without having to write code. The end user could create their own “template” documents. Cons Requires code to know about all the bookmarks. 15 min 35 min

Create Word Documents: Using Bookmarks: “Real World” Implementation Application for police departments to create Wanted Posters.

Create Word Documents: Using Bookmarks – Create “Template” Document Insert Bookmark Insert -> Bookmark Give the bookmark a name Click “Add” button Making Bookmarks visible File -> Options Advanced -> Show document content Show bookmarks

Create Word Documents: Using Bookmarks Demo Bookmarks in a Word Document

Create Word Documents: Using Bookmarks Header and Footer Bookmarks Create Header Insert -> Header Insert Bookmark Insert -> Bookmark Give the bookmark a name Click “Add” button Design -> Close Header and Footer 20 min 30 min

Create Word Documents: Using Bookmarks and WordLite Open a word document with Bookmarks. Replace bookmarks with text. Replace image. Get the header and replace bookmark with text. Get the footer and replace bookmark with text.

Create Word Documents: Using Bookmarks Identifying the header and footer Open the document in the “Open XML SDK 2.0 Productivity Tool”. Open each header and footer and look for the bookmark. Identifying the image name (option 1) Open the document in the “Open XML SDK 2.0 Productivity Tool” Locate the image. Identifying the image name (option 2) Change the extension on the Word document to .zip Extract the contents of the .zip file and look at each image.

Create Word Documents: Using Bookmarks and WordLite Review WordController.ProductBookmarks Controller Action.

Create Word Documents: Using Bookmarks and WordLite Add bookmark to the document. Replace bookmark with image. doc.Bookmarks["Image"].ReplaceWithImage( @“C:\Images", “kendo.png”, "image/png"); 25 min

Create Word Documents: Using Bookmarks Demo Allowing End User to Create Templates

Creating Word Documents: Using XSLT Pros Templates can be changed without having to recompile. .NET code is simplified. Good approach when the document format does not change much over time. Cons Templates can get a bit complicated to manipulate. 30 min 20 min

Creating Word Documents: Using XSLT : “Real World” Implementation Creating Government Contracting Documents

Creating Word Documents: Review Open XML Package Definition An Open XML Package is a zip file containing XML documents, images and other files needed to display the document in a Microsoft Office application.

Creating Word Documents: Using XSLT Create Word Document Put “placeholders” for values Save document Create XSLT file Rename .docx to .zip Open zip file and get the word/document.xml file Rename with .xslt extension Replace: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> With: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match=“/"> Add to the end of the file: </xsl:template> </xsl:stylesheet>

Creating Word Documents: Using XSLT products.xml <productList> <products> <product id=“…“ name=“…“ summary=“...“ image=“…“ price=“…“ overview=“..." /> </products> </productList> XPath editor - http://qutoric.com/xmlquire/

Creating Word Documents: Using XSLT <xsl:value-of select=“”/> <xsl:if test=“”></xsl:if> <xsl:for-each select=“”></xsl:for-each>

Creating Word Documents: Using XSLT Demo Implementing XSL Template. Review WordController.ProductXslt Controller Action.

Creating Word Documents: Using XSLT Adding C# Support to XSLT xmlns:msxsl="urn:schemas-microsoft-com:xslt“ xmlns:cs="urn:custom-csharp“ <msxsl:script language="C#" implements-prefix="cs"> <![CDATA[ public string FormatPrice(int price) { return string.Format("{0:c0}", price); } ]]> </msxsl:script> 35 min 15 min

Creating Word Documents: Using XSLT Demo Implementing C# Support to XSLT Review WordController.ProductXsltWithScript Controller Action.

Creating Word Documents: Using XSLT Adding Header and Footer Create document with header and footer Rename .docx to .zip Open zip file and get the word/header.xml file and word/footer.xml file Rename with .xslt extension Replace: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> With: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match=“/"> Add to the end of the file: </xsl:template> </xsl:stylesheet>

Creating Word Documents: Using XSLT Review WordController.ProductXsltWithHeaderFooter Controller Action.

Creating Excel Documents: Options Open XML SDK 2.0 Productivity Tool for MS Office Using the SDK Using SpreadsheetLight 40 min 10 min

Creating Excel Documents: “Open XML SDK 2.0 Productivity Tool” Create and Save Excel Document Open the Excel Document using “Open XML SDK 2.0 Productivity Tool” In “Document Explorer”, right-click on root and select “Reflect Code”. Create console app in Visual Studio. Add references to required assemblies. Create new class for the “generated code”. Instantiate class and call CreatePackage from Main.

Creating Excel Documents: Using the SDK Code Project article: Creating basic Excel workbook with Open XML by Mika Wendelius

Creating Excel Documents: Using SpreadsheetLight http://spreadsheetlight.com/ “SpreadsheetLight is an open source spreadsheet library/component for .NET Framework written in C#. It is freely available and uses the MIT License. It generates Open XML spreadsheets that are compatible with Microsoft Excel 2007/2010/2013 (and even LibreOffice Calc).”

Creating Excel Documents: Using SpreadsheetLight Features used: Setting Document Properties Rename Worksheet Set Column Heading Styles Set Column Widths Format Currency Cells Define Formulas Create Charts Protect Worksheet

Creating Excel Documents: Using SpreadsheetLight Demo using SpreadsheetLight Review ExcelController.SalesByYear Controller Action.

Creating Excel Documents: Using SpreadsheetLight Adding a Chart SLChart CreateChart – define the range for the data to be used. SetChartType – set the type of chart to create SetChartPosition – where the chart will appear in the worksheet SetChartStyle – style for the chart. SLDocument.InsertChart – insert the chart into the current worksheet. 45 min 5 min

Creating Excel Documents: Using SpreadsheetLight Demo creating Chart Review ExcelController.SalesByYearWithChart Controller Action.

Presentation and Source Code Where can I find the presentation and source code? www.aspnetwiki.com

Questions

Future Presentations Creating MVC Extensions for the jQuery UI Library that can be used with the Razor and ASPX (WebForms) View Engines. Creating mobile application games using the “Crafty” JavaScript Gaming Engine and PhoneGap. Creating Desktop/Mobile/Web Applications with HTML5 / JavaScript, node.js, Kendo UI, and node-webkit using the same code base. 50 min

Thank You techgate@hotmail.com An email will be sent to all attendees on Monday, September 23 announcing location of slides received from presenters.