Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure...

21
Transform Open XML Documents with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer

Transcript of Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure...

Page 1: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Transform Open XML Documents with Open XML SDK, Azure Functions and Microsoft Flow

Tom Jebo

Sr Escalation Engineer

Page 2: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

India 2014

Frustration!

Page 3: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

What if…we could automate?

Goals• Allow presenters to upload their slide deck

• Automatically process the deck to change the theme

What do we need?• A repository for the decks

• An understanding of Open XML File Format

• A way to programmatically transform a deck

• A way to automate the process

Page 4: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Agenda

Overview to Open XML File Format Markup Languages

Open XML SDK

Demo: Transforming a Presentation

Tools, Support & Resources

Page 5: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Brief history of Office Open XML

2000

First XML based format used by

OfficeXP

2003

Microsoft Office XML format

released in Office 2003

2005/6

Office Open XML submitted to ECMA

Int’l

2007

Office 2007 makes OOXML default file

format

2008

ISO/IEC 29500:2008 published

Page 6: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Support by Office Version

First to support OOXML, default format

ECMA-376 support

ISO/IEC 29500 “Transitional” r/w

ISO/IEC 29500 “Strict” read

ECMA-376 read

ISO/IEC 29500 “Strict” r/wi.e. File | Save As… and choose “Strict Open XML Presentation (*.pptx)

“Strict” r/w

Page 7: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Get the standardiso 29500 download

Page 8: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Parts of the ISO 29500 Standard

Parts

Reference

Part 1MarkupFundamentals

Packaging

Model

Part 2Open Packaging

MCE elements

and attributes

Part 3Compatibility/Extensibility

Namespaces

and elements in

transitional

markup

Part 4Transitional

Page 9: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

WordprocessingML, SpreadsheetML, PresentationML & DrawingML

• Parts and elements to get started:

• WordprocessingML• 11.3.10 (document.xml)

• 17.2 and 17.3 (body, paragraphs and runs)

• SpreadsheetML• 12.3.24 (sheet<x>.xml)

• 18.3 (Worksheet elements)

• PresentationML• 13.3.8 (slide<x>.xml)

• 19.3 (slide elements)

• Schemas: • Annex A – W3C XML1

• Annex B – RELAX NG9

• Primer• Annex L – detailed intro to the ML’s. Use this!

<w:document<w:body><w:p w14:paraId="2673269E" w14:textId="522FD3EB" w:rsidR="00BD0355" w:rsidRDefault="00BD0355">

<w:r><w:t xml:space="preserve">This is a run of text. It is part of a paragraph.

</w:r></w:p>

<w:p w14:paraId="43453C87" w14:textId="3F744A5F" w:rsidR="00BD0355" w:rsidRDefault="00BD0355"><w:r>

<w:t>Here is another run of text in a new paragraph.</</w:r>

</w:p>

<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml<dimension ref="A1:B4"/><sheetData>

<row r="1" spans="1:2" x14ac:dyDescent="0.25"><c r="A1">

<v>1</v></c>

</row><row r="2" spans="1:2" x14ac:dyDescent="0.25">

<c r="A2"><v>2</v>

</c></row><row r="4" spans="1:2" x14ac:dyDescent="0.25">

<c r="B4" t="s"><v>1</v>

</c>

<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" <p:cSld>

<p:spTree><p:sp>

<p:nvSpPr><p:cNvPr id="2" name="Title 1"/><p:cNvSpPr>

<a:spLocks noGrp="1"/></p:cNvSpPr>

</p:nvSpPr><p:spPr/><p:txBody>

<a:p><a:r>

<a:rPr lang="en-US" dirty="0" smtClean<a:t>Fancy art from the internet</a:t

</a:r>

Page 10: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Supporting Open Specifications[MS-OI29500]

Notes for Microsoft Office products implementing ISO/IEC 29500

[MS-ODRAWXML]

[MS-DOCX]

[MS-XLSX]

[MS-PPTX]Extensions to the DrawingML, WordprocessingML, SpreadsheetML and PresentationML standard elements defined in ISO/IEC

29500

See reference note for URL to MSDN page for these.10

Page 11: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Open XML SDK on Github

Page 12: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Open XML SDK on GithubGithub

Fork, build, modify

Nuget package

Release and latest builds

Issues

Report bugs

Contribution

Enhancements, fixes

Page 13: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

SDK Classes

OOXMLSDK API

Part API DOM APIFramework

APISchema

validationSemantic validation

DocumentFormat.OpenXml.dll

1. Generate OpenXmlPartAPI Source

Code

2. Build Framework

API

3. Process Schema Files

4. Generate DOM API

Source Code

5. Generate Schema

Validation Data

6. Generate Semantic Validation

Data

7. Build DocumentFormat.OpenXML DLL

SDK Class generation process

Page 14: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Lig

ht B

lue

R0 G

188 B

242

Gre

en

R16 G

124 B

16

Red

R232 G

17 B

35

Mag

en

taR

180 G

0 B

158

Pu

rple

R92 G

45 B

145

Blu

eR

0 G

120 B

215

Teal

R0 G

130 B

114

Yello

wR

255 G

185 B

0

Ora

ng

eR

216 G

59 B

1

Lig

ht Y

ello

wR

255 G

241 B

0Lig

ht O

ran

ge

R255 G

140 B

0Lig

ht M

ag

en

taR

227 G

0 B

140

Lig

ht P

urp

leR

180 G

160 B

255

Lig

ht T

eal

R0 G

178 B

148

Lig

ht G

reen

R186 G

216 B

10

Dark

Red

R168 G

0 B

0D

ark

Mag

en

ta

R92 G

0 B

92

Dark

Pu

rple

R50 G

20 B

90

Mid

Blu

eR

0 G

24 B

143

Dark

Teal

R0 G

75 B

80

Dark

Gre

en

R0 G

75 B

28

Dark

Blu

eR

0 G

32 B

80

Mid

Gra

yR

115 G

115 B

115

Dark

Gra

yR

80 G

80 B

80

Ric

h B

lack

R0 G

0 B

0

Wh

iteR

255 G

255 B

255

Gra

yR

210 G

210 B

210

Lig

ht G

ray

R230 G

230 B

230

Generation Extraction Transform

WordprocessingML

SpreadsheetML

PresentationML

Page 15: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Lig

ht B

lue

R0 G

188 B

242

Gre

en

R16 G

124 B

16

Red

R232 G

17 B

35

Mag

en

taR

180 G

0 B

158

Pu

rple

R92 G

45 B

145

Blu

eR

0 G

120 B

215

Teal

R0 G

130 B

114

Yello

wR

255 G

185 B

0

Ora

ng

eR

216 G

59 B

1

Lig

ht Y

ello

wR

255 G

241 B

0Lig

ht O

ran

ge

R255 G

140 B

0Lig

ht M

ag

en

taR

227 G

0 B

140

Lig

ht P

urp

leR

180 G

160 B

255

Lig

ht T

eal

R0 G

178 B

148

Lig

ht G

reen

R186 G

216 B

10

Dark

Red

R168 G

0 B

0D

ark

Mag

en

ta

R92 G

0 B

92

Dark

Pu

rple

R50 G

20 B

90

Mid

Blu

eR

0 G

24 B

143

Dark

Teal

R0 G

75 B

80

Dark

Gre

en

R0 G

75 B

28

Dark

Blu

eR

0 G

32 B

80

Mid

Gra

yR

115 G

115 B

115

Dark

Gra

yR

80 G

80 B

80

Ric

h B

lack

R0 G

0 B

0

Wh

iteR

255 G

255 B

255

Gra

yR

210 G

210 B

210

Lig

ht G

ray

R230 G

230 B

230

Real World Usage

• Microsoft Open Specifications!

• Microsoft internal/public

• Many major organizations

Page 16: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

High-performance extraction, modification and generation of

Page 17: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Lig

ht B

lue

R0 G

188 B

242

Gre

en

R16 G

124 B

16

Red

R232 G

17 B

35

Mag

en

taR

180 G

0 B

158

Pu

rple

R92 G

45 B

145

Blu

eR

0 G

120 B

215

Teal

R0 G

130 B

114

Yello

wR

255 G

185 B

0

Ora

ng

eR

216 G

59 B

1

Lig

ht Y

ello

wR

255 G

241 B

0Lig

ht O

ran

ge

R255 G

140 B

0Lig

ht M

ag

en

taR

227 G

0 B

140

Lig

ht P

urp

leR

180 G

160 B

255

Lig

ht T

eal

R0 G

178 B

148

Lig

ht G

reen

R186 G

216 B

10

Dark

Red

R168 G

0 B

0D

ark

Mag

en

ta

R92 G

0 B

92

Dark

Pu

rple

R50 G

20 B

90

Mid

Blu

eR

0 G

24 B

143

Dark

Teal

R0 G

75 B

80

Dark

Gre

en

R0 G

75 B

28

Dark

Blu

eR

0 G

32 B

80

Mid

Gra

yR

115 G

115 B

115

Dark

Gra

yR

80 G

80 B

80

Ric

h B

lack

R0 G

0 B

0

Wh

iteR

255 G

255 B

255

Gra

yR

210 G

210 B

210

Lig

ht G

ray

R230 G

230 B

230

1

3

2

4

Page 18: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Upcoming Sessions

Data Portability on the Cloud with the Office Open XML SDK

Page 19: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Tools

Open XML Package Editor for Visual Studio:

https://github.com/OfficeDev/Open-XML-Package-Editor-Power-Tool-for-Visual-Studio

OOXML Tools Extension for Chrome

(search “ooxml tools chrome” and install in Chrome)

Open XML SDK Productivity Tool

(search “open xml sdk 2.5”, click download, OpenXMLSDKToolV25.msi)

Page 20: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What

Support & ResourcesSDK

Open XML SDK

https://github.com/OfficeDev/Open-Xml-Sdk

OpenXMLDeveloper

http://www.openxmldeveloper.org

libopc

http://libopc.codeplex.com (third-party open source OOXML library)

Transforming Open XML Documents using XSLThttps://blogs.msdn.microsoft.com/ericwhite/2008/09/29/transforming-open-xml-documents-using-xslt/

Azure Functions

https://docs.microsoft.com/en-us/azure/azure-functions/

Open Specifications

[email protected]

https://social.msdn.microsoft.com/Forums/en-US/home?category=openspecifications

Page 21: Transform Open XML Documents with Open XML SDK, Azure ...€¦ · with Open XML SDK, Azure Functions and Microsoft Flow Tom Jebo Sr Escalation Engineer. India 2014 Frustration! What