Introduction to Office Open XML Code Snippets

Sign in to queue

Description

In this screencast, Office program manager Kevin Boske demos three code snippets for Visual Studio 2005 for working with Office Open XML files using the System.IO.Packaging namespace from .NET 3.0. Office Open XML is a file format standardized by Ecma. It is the new default file format for Word, Excel and PowerPoint 2007. The ability to programmatically access data within these file formats is a key feature for developers.

Ken Getz wrote 40 Visual Studio 2005 code snippets in C# and VB.Net for working with the Open XML files that are downloadable from the web. The Office Open XML code snippets include snippets for redacting macros from Word Documents, adding string values to cells in Excel workbooks, finding slides by title in PowerPoint, etc.

These code snippets will help you get started building applications to directly access data within Open XML files.

Related links:
Office Open XML Code Snippets
Managing VS.NET 2005 Code Snippets
OpenXMLDeveloper.org
Kevin Boske’s Blog

The Discussion

  • User profile image
    babba

    i can't see the screen cast...

  • User profile image
    dmahugh
    There was a bad link, Babba, but it's fixed now.  Sorry for the inconvenience.
  • User profile image
    nbradshaw
    Sorry but the audio level is very low, I can just about make out what's said if I have my volume really high but it's giving me a headache trying to listen!. Sad
  • User profile image
    Tamkin
    I have to create a Custom Connector like a Custom Shape in a PPTX using OOXml. As, bent connector or curve connector bent on 90 degree only, so like a custom shape i have to create a custom connector, because my connector can go through any path. I download the "OfficeOpenXML-DrawingMLGeometries.zip" where i found a definition of preset Shapes on the file "presetShapeDefinitions.xml" , in this file Bentconnector2 is defined by:

    ----------------------------------------------------------------------------------------------------
    <bentConnector2>
        <rect l="l" t="t" r="r" b="b" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" />
        <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
          <path fill="none">
            <moveTo>
              <pt x="l" y="t" />
            </moveTo>
            <lnTo>
              <pt x="r" y="t" />
            </lnTo>
            <lnTo>
              <pt x="r" y="b" />
            </lnTo>
          </path>
        </pathLst>
      </bentConnector2> 
    -----------------------------------------------------------------------------------------------------
    That means bent connector2 is being drawn in this way. But, now i want to create a custom connector like above one. My slide1.xml contain a connection shape like....

    ----------------------------------------------------------------------------------------------------
    <p:cxnSp>
            <p:nvCxnSpPr/>    
            <p:spPr>
              <a:xfrm >
                <a:off x="3886200" y="2362200"/>
                <a:ext cx="914400" cy="914400"/>
              </a:xfrm>
              <a:custGeom >
                    <rect l="l" t="t" r="r" b="b" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" />
                         <pathLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
                             <path fill="none">
                                    <moveTo>
                                       <pt x="l" y="t" />
                                  </moveTo>
                                 <lnTo>
                                       <pt x="r" y="t" />
                              </lnTo>
                              <lnTo>
                                      <pt x="r" y="b" />
                             </lnTo>
                            </path>
                          </pathLst>
              </a:custGeom>
            </p:spPr>
            <p:style/>        
    </p:cxnSp>
    -----------------------------------------------------------------------------------------------------
    Rather than....
    ----------------------------------------------------------------------------------------------------
    <p:cxnSp>
            <p:nvCxnSpPr/>    
            <p:spPr>
              <a:xfrm >
                <a:off x="3886200" y="2362200"/>
                <a:ext cx="914400" cy="914400"/>
              </a:xfrm>
              <a:prstGeom prst="bentConnector2">  // Generally We define in this way to create a Predefined Connector
                <a:avLst/>            
              </a:prstGeom>
            </p:spPr>
            <p:style/>        
    </p:cxnSp>
    -----------------------------------------------------------------------------------------------------
     But it gives always an error when open that pptx, It says pptx has been corrupted .....
     Plz, help me how i can fix this problem...??? If it is not possible for you to help me rgarding this metter, then Where should i go ? where i can get the actual cause, Plz mention me....

    Thanks and Regards
    Tamkin
    SW ENG. (KAZ Software)
    Bangladesh
  • User profile image
    tswaters

    it seems the link is missing?

Add Your 2 Cents