Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Started OpenXml and PowerPoint

I would like to develop a class library that could process PowerPoint templates, and populate formatted data. Mainly involving tables, labels, slide cloning. I would like to use Open Xml for this with .Net 4.

I would like some recommendations and references for this. Also would like to know which approach is good, whether to go with OpenXml SDK 2.0 or System.Packaging because I read in some places that using Open Xml SDK consumes bit more memory.

Thanks, Aneef

like image 561
Aneef Avatar asked Feb 24 '12 06:02

Aneef


People also ask

Is OpenXml still supported?

About the Open XML SDK 2.5 for Office | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Does OpenXml require office?

No. You only need to have a reference to the library that provides all the OpenXML functionality. That library is not dependant on Office. OpenXML will only handle the new file formats, not the old DOC and DOT.

What is the difference between OpenXml and ClosedXml?

Macros – ClosedXml doesn't support macros as its base library OpenXml also doesn't support it. Embedding – We cannot embed any file into Excel using ClosedXml, no APIs built for that, so some features of OpenXml still need to be implemented. Charts – No functionality related to charting is present.

What is Microsoft OpenXml?

Office Open XML (also informally known as OOXML) is a zipped, XML-based file format developed by Microsoft for representing spreadsheets, charts, presentations and word processing documents. Ecma International standardized the initial version as ECMA-376. ISO and IEC standardized later versions as ISO/IEC 29500.


3 Answers

The Open XML SDK 2.0 is built on top of System.Packaging so it will be easier to write and maintain the code. I found I was able to write two lines of Open XML SDK code whereas when I had wrote it using System.Packaging it was over 200 lines. As far as using more memory, I have not ran into any issues and have found maintainability and readability to out weigh the minimal increase in memory usage.

There aren't many resources out there for using the Open XML SDK with Power Point, but here are two to get you started:

Brian Jones & Zeyad Rajabi blog

MSDN

like image 112
amurra Avatar answered Sep 28 '22 03:09

amurra


I would first recommend you understand the Presentation Markup Language (PresentationML) before you start using any of the APIs.

There is a free online book that describes PresentationML, WordML, and SpreadsheetML called Open XML Explained. Chapter 3 describes PresentationML and gives you the knowledge required to better use the OpenXML API to do all of the tasks you need to do.

like image 30
Taterhead Avatar answered Sep 28 '22 02:09

Taterhead


A good start for me was using the Document Reflector (Reflect Code tool in the Open XML Productivity Tool of SDK 2.5). Load a .pptx and get the C# code to generate that .pptx - so you learn the structure of PresentationML and get an idea where to put the parameters and options you want - it's not easy, but a good start

like image 20
outofmind Avatar answered Sep 28 '22 02:09

outofmind