May, 2008

  • Pranav ... Blogging

    One more step in the right direction, native ODF support in Office 2007 SP2

    • 1 Comments

    imageDid’ya see dat! I am pretty exited about these developments, As soon as these this is out I want to play with it and see how can this feature be utilized in Office Programmability scenarios

    Are you surprised ? WHY ? It’s fairly consistent with our idea of promoting & encouraging freedom of choice.

    Also, Microsoft will join the OASIS ODF Technical Committee, and users will be able to set ODF to be the default format in their Office Applications.

    For more details have a look at following posts.

    · Office support for document format standards – Doug Mahugh,

    · Microsoft Announces Support for More Document Format Standards, including ODF – Eric White

    · Microsoft adds “Save as ODF” to Office 2007 Service Pack 2 – Gray Knowlton

    · Open XML, ODF, PDF, and XPS in Office – Jason Matusow

    · OpenXML & ODF was never a zero-sum game – Stephen McGibbon

    · Open XML Formats: ODF support in Office – Brian Jones

    · More Interop for Microsoft Office (ODF, PDF, PDF/A, XPS) – Oliver Bell



     

    Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

  • Pranav ... Blogging

    What’s "Works on My Machine" Certification Program anyways ?

    • 0 Comments

    A few of my readers asked me, what’s do I mean by "Works on My Machine certified”, in my previous post. Here is the ans -  All of this thing started with Joseph Cooney – He got an interestingly funny and brilliant idea. Which, in itself, works-on-my-machine-stampedserves as a code disclaimer. Then Jeff Atwood(coding horror  fame …) zazzed things up and came up with following images!

    Maybe this is really a disclaimerworks-on-my-machine-starburst that I was looking for  -

     

     



                                                         

     

    Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

     

     

  • Pranav ... Blogging

    Creating a new presentation by pulling slides from a presentation

    • 3 Comments

    You’ll remember that a few days back I’ve posted a code snippet which demonstrates how to create a PowerPoint presentation from scratch using System.IO.Packaging.

    Here is the next part of the same code which is “works on my machine” certified :)

    This is a simple WinForms Application which demonstrates how to  pull the slides from a presentation and creates a new presentation.

    In simplest terms this is what the code is doing -

    1. It let’s you browse to a PowerPoint presentation, iterates through all the slides and displays the slide heading  (GetSlideTitles)

    2. Once you select the slides you want from the presentation, it pulls those slides and associated slide layouts from the presentation. Then it adds the slides to a new presentation. (PullSlide, GetURIFromTitle, AddSlide)

    Imports System.IO
    Imports System.IO.Packaging
    Imports System.Xml
    Public Class Form1
        Dim ppt As New pptHelper
        Private Sub SelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFile.Click
            Dim rs As DialogResult
            Dim items() As Object = Nothing
    
            OpenFileDialog1.Filter = "PowerPoint Presentation|*.pptx"
            rs = OpenFileDialog1.ShowDialog()
    
            If rs = Windows.Forms.DialogResult.OK Then
                SlideList.Items.Clear()
                items = ppt.GetSlideTitles(OpenFileDialog1.FileName).ToArray()
                SlideList.Items.AddRange(items)
            End If
        End Sub
    
        Public Sub MoveSlide(ByVal filename As String, ByVal slidetitle As String, ByVal remove As Boolean) ' function which will be called from "move" and "move all" 
    
            SelectedSlides.Items.Add(slidetitle) ' add it to the selected slide list
            If remove Then
                SlideList.Items.Remove(SlideList.SelectedItem) ' removing it from the slidelist (just to ensure that you don't add slides multiple times)
            End If
        End Sub
        Private Sub Move_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectSlide.Click
            MoveSlide(OpenFileDialog1.FileName, SlideList.SelectedItem.ToString, True)
        End Sub
        Private Sub MoveAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAll.Click
    
            For Each o As Object In SlideList.Items ' Iterating through the listbox and moving everything to selected file list
                MoveSlide(OpenFileDialog1.FileName, o.ToString, False)
            Next o
    
            SlideList.Items.Clear() ' clearing the list
        End Sub
    
    
    
        Private Sub CreatePresentation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreatePresentation.Click
            Dim rs As DialogResult
            Dim source As Package = Nothing
            Dim target As Package = Nothing
            'Dim p As Package = Nothing
    
            SaveFileDialog1.Filter = "PowerPoint Presentation|*.pptx"
            rs = SaveFileDialog1.ShowDialog()
    
            If rs = Windows.Forms.DialogResult.OK Then
                target = Package.Open(SaveFileDialog1.FileName, FileMode.Create, FileAccess.ReadWrite)
                source = Package.Open(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
            End If
    
            ppt.CreateBasicPresentation(target)
    
            For Each s As Object In SelectedSlides.Items
                ppt.CopySlide(source, target, s.ToString(), pptHelper.relations.slidePart)
            Next
            target.Flush()
            target.Close()
            MsgBox("Done!")
        End Sub
    End Class
    
    
    
    Public Class pptHelper
    
     
    
        Public Class contents
            Public Shared presentation = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
            Public Shared slidemaster = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"
            Public Shared slideLayout = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"
            Public Shared slidePart = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml"
            Public Shared themePart = "application/vnd.openxmlformats-officedocument.theme+xml"
        End Class
    
        Public Class relations
            Public Shared officedocument = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
            Public Shared slidemaster = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"
            Public Shared slidelayout = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
            Public Shared slidePart = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
            Public Shared themePart = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
            Public Shared mainPart = "http://schemas.openxmlformats.org/presentationml/2006/main"
            Public Shared relationship = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
        End Class
    
    
    
        Dim id As Integer = CInt(New Random().NextDouble * 10000)
    
        Public Function AddSlide(ByVal pkg As Package, ByVal sldPart As PackagePart) As Boolean
            Dim xmlDoc As New XmlDocument
            Dim rId As String
            Dim xNode As XmlNode
            Dim partUri As Uri
    
    
            ' manage namespaces to perform Xml XPath queries.
            Dim nt As New NameTable()
            Dim nsManager As New XmlNamespaceManager(nt)
            nsManager.AddNamespace("p", relations.mainPart)
            nsManager.AddNamespace("r", relations.relationship)
            ' end manage
    
            Dim slide As PackagePart = pkg.CreatePart(sldPart.Uri, sldPart.ContentType)
    
    
            ' connect it with doc part and update document.xml
            Dim doc As PackagePart = pkg.GetPart(New Uri("/ppt/presentation.xml", UriKind.Relative))
            rId = doc.CreateRelationship(slide.Uri, TargetMode.Internal, relations.slidePart).Id
    
            xmlDoc.Load(doc.GetStream())
            xNode = xmlDoc.CreateNode(XmlNodeType.Element, "p", "sldId", relations.mainPart)
            Dim attrId As XmlAttribute = xmlDoc.CreateAttribute("id")
            attrId.Value = id.ToString()
            Dim attrRId As XmlAttribute = xmlDoc.CreateAttribute("r:id", relations.relationship)
            attrRId.Value = rId
            xNode.Attributes.SetNamedItem(attrId)
            xNode.Attributes.SetNamedItem(attrRId)
            'xNode.Attributes. = "<p:sldId id=" & id.ToString() & " r:id=" & rId & "/>"
            id = id + 1
    
            xmlDoc.SelectSingleNode("//p:sldIdLst", nsManager).AppendChild(xNode)
            xmlDoc.Save(doc.GetStream(FileMode.Create, FileAccess.ReadWrite))
            ' end connect
    
            'get slide layout part from the slide
            For Each r As PackageRelationship In sldPart.GetRelationshipsByType(relations.slidelayout)
                Console.WriteLine(r.TargetUri.OriginalString)
                partUri = PackUriHelper.ResolvePartUri(r.SourceUri, r.TargetUri)
                Exit For ' only one layout
            Next
            Dim lyt_src As PackagePart = sldPart.Package.GetPart(partUri)
            Dim layout As PackagePart = Nothing
    
            Try
                layout = pkg.CreatePart(lyt_src.Uri, lyt_src.ContentType)
                xmlDoc.Load(lyt_src.GetStream())
                xmlDoc.Save(layout.GetStream(FileMode.Create, FileAccess.ReadWrite))
                ' add relationships
                Dim master As PackagePart = pkg.GetPart(New Uri("/ppt/slideMasters/slideMaster1.xml", UriKind.Relative))
                rId = master.CreateRelationship(layout.Uri, TargetMode.Internal, relations.slidelayout).Id
                xNode = xmlDoc.CreateNode(XmlNodeType.Element, "p", "sldLayoutId", relations.mainPart)
                attrId = xmlDoc.CreateAttribute("id")
    
                ''BUGBUG: id attribute of <sldLayoutId> element needs to be pulled from the source presentation/package
                Dim srcSldMasterPart As PackagePart = sldPart.Package.GetPart(New Uri("/ppt/slideMasters/slideMaster1.xml", UriKind.Relative))
                Dim xmlDocSrcMaster As New XmlDocument
                Dim sSldLayourRId As String = ""
                Dim sldLytPartUri As Uri
                xmlDocSrcMaster.Load(srcSldMasterPart.GetStream())
                For Each r As PackageRelationship In srcSldMasterPart.GetRelationshipsByType(relations.slidelayout)
    
                    Console.WriteLine(r.TargetUri.OriginalString)
                    sldLytPartUri = PackUriHelper.ResolvePartUri(r.SourceUri, r.TargetUri)
                    If Uri.Compare(sldLytPartUri, partUri, UriComponents.Path, UriFormat.Unescaped, StringComparison.CurrentCulture) = 0 Then
                        sSldLayourRId = r.Id
                        Exit For
                    End If
    
                Next
    
                Dim xmlNodeSrcLayoutId As XmlNode = xmlDocSrcMaster.SelectSingleNode("//p:sldLayoutIdLst/p:sldLayoutId[@r:id='" & sSldLayourRId & "']", nsManager)
    
                Dim sSlideLayoutId As String = xmlNodeSrcLayoutId.Attributes.GetNamedItem("id").Value
                attrId.Value = sSlideLayoutId
                attrRId = xmlDoc.CreateAttribute("r:id", relations.relationship)
                attrRId.Value = rId
                xNode.Attributes.SetNamedItem(attrId)
                xNode.Attributes.SetNamedItem(attrRId)
                'xNode.Value = "<p:sldLayoutId id=" & id.ToString & " r:id=" & rId & "/>"
                id = id + 1
    
                layout.CreateRelationship(master.Uri, TargetMode.Internal, relations.slidemaster)
    
    
    
                xmlDoc.Load(master.GetStream())
                xmlDoc.SelectSingleNode("//p:sldLayoutIdLst", nsManager).AppendChild(xNode)
                xmlDoc.Save(master.GetStream(FileMode.Create, FileAccess.ReadWrite))
                ' end add
    
    
            Catch ex As Exception
                layout = pkg.GetPart(lyt_src.Uri)
            End Try
    
            'end get
            slide.CreateRelationship(layout.Uri, TargetMode.Internal, relations.slidelayout)
    
            xmlDoc.Load(sldPart.GetStream())
            xmlDoc.Save(slide.GetStream(FileMode.Create, FileAccess.ReadWrite))
        End Function
    
    
        Public Function PullSlide(ByRef pkg As Package, ByVal uri As Uri, ByVal relationship As String) As PackagePart
            Dim p As PackagePart = pkg.GetPart(uri)
            Return p
        End Function
    
        Public Function CopySlide(ByRef sourcePkg As Package, ByRef tgtPkg As Package, ByVal sourceSlide As String, ByVal relationship As String) As Boolean
            Dim sourceUri As Uri = GetUriByTitle(sourcePkg, sourceSlide)
            Dim p As PackagePart = PullSlide(sourcePkg, sourceUri, relationship)
            Return AddSlide(tgtPkg, p)
        End Function
        Public Sub CreateBasicPresentation(ByRef p As Package)
            Dim xmlDoc As New XmlDocument
            xmlDoc.LoadXml(My.Resources.presentation)
    
            Dim docUri As Uri = PackUriHelper.CreatePartUri(New Uri("ppt/presentation.xml", UriKind.Relative))
            Dim docPart As PackagePart = p.CreatePart(docUri, contents.presentation)
            p.CreateRelationship(docPart.Uri, TargetMode.Internal, relations.officedocument)
    
            xmlDoc.Save(docPart.GetStream(FileMode.Create, FileAccess.ReadWrite))
    
            Dim themeUri As Uri = PackUriHelper.CreatePartUri(New Uri("ppt/theme/theme1.xml", UriKind.Relative))
            Dim themePart As PackagePart = p.CreatePart(themeUri, contents.themePart)
            docPart.CreateRelationship(themePart.Uri, TargetMode.Internal, relations.themePart)
    
            xmlDoc.LoadXml(My.Resources.theme1)
            xmlDoc.Save(themePart.GetStream(FileMode.Create, FileAccess.ReadWrite))
    
    
            Dim slideMasterUri As Uri = PackUriHelper.CreatePartUri(New Uri("/ppt/slidemasters/slidemaster1.xml", UriKind.Relative))
            Dim slideMasterPart As PackagePart = p.CreatePart(slideMasterUri, contents.slidemaster)
            docPart.CreateRelationship(slideMasterPart.Uri, TargetMode.Internal, relations.slidemaster, "rId1")
    
            xmlDoc.LoadXml(My.Resources.slideMaster1)
    
            slideMasterPart.CreateRelationship(themePart.Uri, TargetMode.Internal, relations.themePart)
            xmlDoc.Save(slideMasterPart.GetStream(FileMode.Create, FileAccess.ReadWrite))
        End Sub
    
        Public Function GetSlideTitles(ByVal fileName As String) As List(Of String)
            ' Return a generic list containing all the slide titles.        
            ' Fill this collection with a list of all the titles
            ' of all the slides in the requested slide deck.
            Dim titles As New List(Of String)
            Dim documentPart As PackagePart = Nothing
            Dim documentUri As Uri = Nothing
    
            Using pptPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read)
                ' Get the main document part (presentation.xml).
                For Each relationship As PackageRelationship In pptPackage.GetRelationshipsByType(relations.officedocument)
                    documentUri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), relationship.TargetUri)
                    documentPart = pptPackage.GetPart(documentUri)
    
                    ' There's only one document part. Get out now.
                    Exit For
                Next
    
                ' Manage namespaces to perform Xml XPath queries.
                Dim nt As New NameTable()
                Dim nsManager As New XmlNamespaceManager(nt)
                nsManager.AddNamespace("p", relations.mainPart)
    
                '  Iterate through the slides and extract the title string from each.
                Dim xDoc As New XmlDocument(nt)
                xDoc.Load(documentPart.GetStream())
    
                Dim sheetNodes As XmlNodeList = xDoc.SelectNodes("//p:sldIdLst/p:sldId", nsManager)
                If sheetNodes IsNot Nothing Then
                    Dim relAttr As XmlAttribute = Nothing
                    Dim sheetRelationship As PackageRelationship = Nothing
                    Dim sheetPart As PackagePart = Nothing
                    Dim sheetUri As Uri = Nothing
                    Dim sheetDoc As XmlDocument = Nothing
                    Dim titleNode As XmlNode = Nothing
    
                    ' Look at each sheet node, retrieving the relationship id.
                    For Each xNode As XmlNode In sheetNodes
                        relAttr = xNode.Attributes("r:id")
                        If relAttr IsNot Nothing Then
                            ' Retrieve the PackageRelationship object for the sheet:
                            sheetRelationship = documentPart.GetRelationship(relAttr.Value)
                            If sheetRelationship IsNot Nothing Then
                                sheetUri = PackUriHelper.ResolvePartUri(documentUri, sheetRelationship.TargetUri)
                                sheetPart = pptPackage.GetPart(sheetUri)
                                If sheetPart IsNot Nothing Then
                                    ' You've got a reference to the sheet. Now load its contents and
                                    ' find the title.
                                    sheetDoc = New XmlDocument(nt)
                                    sheetDoc.Load(sheetPart.GetStream())
    
                                    titleNode = sheetDoc.SelectSingleNode("//p:sp//p:ph[@type='title' or @type='ctrTitle']", nsManager)
                                    If titleNode IsNot Nothing Then
                                        titles.Add(titleNode.ParentNode.ParentNode.ParentNode.InnerText)
                                    End If
                                End If
                            End If
                        End If
                    Next
                End If
            End Using
            Return titles
        End Function
    
        Public Function GetUriByTitle(ByRef pptPackage As Package, ByVal slideTitle As String) As Uri
            ' Given a slide document and a slide title, retrieve the 0-based index of the 
            ' first slide with a matching title. Return -1 if the title isn't found.
    
            ' Note: This code assumes that the first text found is the title.
            ' Also note that if the title contains more than one font,
            ' or is in any way anything other than plain text, PowerPoint
            ' breaks it up into multiple elements. This code won't find a match
            ' in that case.
    
    
            Dim returnValue As Uri
            Dim documentPart As PackagePart = Nothing
    
            'Using pptPackage As Package = package
            ' Get the main document part (presentation.xml).
            For Each relationship As PackageRelationship In pptPackage.GetRelationshipsByType(relations.officedocument)
                Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), relationship.TargetUri)
                documentPart = pptPackage.GetPart(documentUri)
                ' There is only one document.
                Exit For
            Next
    
            ' Manage namespaces to perform Xml XPath queries.
            Dim nt As New NameTable()
            Dim nsManager As New XmlNamespaceManager(nt)
            nsManager.AddNamespace("p", relations.mainPart)
            nsManager.AddNamespace("r", relations.relationship)
    
            ' Get the contents of the presentation part.
            Dim presentationDoc As New XmlDocument(nt)
            presentationDoc.Load(documentPart.GetStream())
    
            '  Iterate through the slides and extract the title string from each.
            Dim slidePart As PackagePart = Nothing
            Dim slideUri As Uri = Nothing
    
            ' Select each slide document part (slides/slideX.xml)
            ' via relationship with document part.
            For Each relation As PackageRelationship In documentPart.GetRelationshipsByType(relations.slidePart)
                slideUri = PackUriHelper.ResolvePartUri(documentPart.Uri, relation.TargetUri)
                slidePart = pptPackage.GetPart(slideUri)
    
                ' Get the slide part from the package.
                Dim doc As XmlDocument = New XmlDocument(nt)
    
                ' Load the slide contents:
                doc.Load(slidePart.GetStream())
    
                ' Locate the slide title using XPath.
                Dim titleNode As XmlNode = doc.SelectSingleNode("//p:sp//p:ph[@type='title' or @type='ctrTitle']", nsManager)
                If titleNode IsNot Nothing Then
                    ' Perform a case-insensitive comparison.
                    Dim titleText As String = titleNode.ParentNode.ParentNode.ParentNode.InnerText
                    If String.Compare(titleText, slideTitle, True) = 0 Then
                        ' You've found the slide part with a matching title.
                        ' Get the relationship ID, and find the corresponding item in the 
                        ' document part:
                        Dim searchString As String = String.Format("//p:sldIdLst/p:sldId[@r:id='{0}']", relation.Id)
                        Dim node As XmlNode = presentationDoc.SelectSingleNode(searchString, nsManager)
                        If node IsNot Nothing Then
                            ' Retrieve the index of the selected node.
                            ' To do that, count the number of preceding
                            ' nodes by retrieving a reference to those nodes.
                            returnValue = slidePart.Uri
                        End If
    
                        ' Only retrieve information about the first slide that matches the specified title.
                        Exit For
                    End If
                End If
            Next
            'End Using
            Return returnValue
        End Function
        Public Function GetUriByTitle(ByVal fileName As String, ByVal slideTitle As String) As String
            ' Given a slide document and a slide title, retrieve the 0-based index of the 
            ' first slide with a matching title. Return -1 if the title isn't found.
    
            ' Note: This code assumes that the first text found is the title.
            ' Also note that if the title contains more than one font,
            ' or is in any way anything other than plain text, PowerPoint
            ' breaks it up into multiple elements. This code won't find a match
            ' in that case.
    
            Dim returnValue As String = ""
            Dim documentPart As PackagePart = Nothing
    
            Using pptPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite)
                ' Get the main document part (presentation.xml).
                GetUriByTitle(pptPackage, slideTitle)
    
            End Using
            Return returnValue
        End Function
    
    End Class

     

     

    Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

  • Pranav ... Blogging

    Word 2007 “Save As Word XML document” and back without automation – 1

    • 4 Comments

    Did you even had a look at new Word XML File? or … like me, you also assumed that it’s going to be same or similar to Word 2003 XML?

    Yesterday … one of my fellow MSFT was  working on Packaging API to create and modify a document.

    We had a quick conversation …

    Manjunath Khatawkar‎‎ [11:32 PM]:
    Hi Pranav.. We are storing the WordOpenXml in database and I'm trying to create a new Package from the stored WordOpenXml string.. I keep getting the "File contains corrupted data" error.. but if i open a normal .docx file it works fine..
    How can I create a Package from WordOpenXml string?

    ‎‎Pranav Wagh‎‎ [12:06 AM]:
      can you give me a sort of code snippet ..so that I can comment on it?

     

    He sent me an email -

    Hi Pranav,

    I’m storing the WordOpenXml (see attachment) of a Word 2007 document in database.

    During document assembly, I retrieve WordOpenXml from DB save it as a xml file on harddisk. When I try to create a Package, I get the "File contains corrupted data" exception. But if I open the xml in Word 2007 and save it as a .docx file, then I’m able to create a package.

    Following is the code snippet

    Package wordPackage = Package.Open(fileName);

    What am I doing wrong here? Do I need to create package from scratch and add individual ParakagePart by looping thro’ the Xml?

    Let me know.

    Thanks,

    Manju

     

    What !! I didn’t even understand this email till I have the super surprise in front of me, in the form of XML file that he sent me  -

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?mso-application progid="Word.Document"?>
    <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
      <pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
        <pkg:xmlData>
          <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
            <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
            <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
            <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
          </Relationships>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="256">
        <pkg:xmlData>
          <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
            <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml"/>
            <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
            <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
            <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
            <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/>
          </Relationships>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
        <pkg:xmlData>
          <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
            <w:body>
              <w:p w:rsidR="00C507F1" w:rsidRDefault="000B50AA">
                <w:r>
                  <w:t>ABC</w:t>
                </w:r>
              </w:p>
              <w:sectPr w:rsidR="00C507F1" w:rsidSect="00262153">
                <w:pgSz w:w="12240" w:h="15840"/>
                <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
                <w:cols w:space="720"/>
                <w:docGrid w:linePitch="360"/>
              </w:sectPr>
            </w:body>
          </w:document>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/theme/theme1.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.theme+xml">
        <pkg:xmlData>
          <a:theme name="Office Theme" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
            <a:themeElements>
              <a:clrScheme name="Office">
                <a:dk1>
                  <a:sysClr val="windowText" lastClr="000000"/>
                </a:dk1>
                <a:lt1>
                  <a:sysClr val="window" lastClr="FFFFFF"/>
                </a:lt1>
                <a:dk2>
                  <a:srgbClr val="1F497D"/>
                </a:dk2>
                <a:lt2>
                  <a:srgbClr val="EEECE1"/>
                </a:lt2>
                <a:accent1>
                  <a:srgbClr val="4F81BD"/>
                </a:accent1>
                <a:accent2>
                  <a:srgbClr val="C0504D"/>
                </a:accent2>
                <a:accent3>
                  <a:srgbClr val="9BBB59"/>
                </a:accent3>
                <a:accent4>
                  <a:srgbClr val="8064A2"/>
                </a:accent4>
                <a:accent5>
                  <a:srgbClr val="4BACC6"/>
                </a:accent5>
                <a:accent6>
                  <a:srgbClr val="F79646"/>
                </a:accent6>
                <a:hlink>
                  <a:srgbClr val="0000FF"/>
                </a:hlink>
                <a:folHlink>
                  <a:srgbClr val="800080"/>
                </a:folHlink>
              </a:clrScheme>
              <a:fontScheme name="Office">
                <a:majorFont>
                  <a:latin typeface="Cambria"/>
                  <a:ea typeface=""/>
                  <a:cs typeface=""/>
                  <a:font script="Jpan" typeface="MS ゴシック"/>
                  <a:font script="Hang" typeface="맑은 고딕"/>
                  <a:font script="Hans" typeface="宋体"/>
                  <a:font script="Hant" typeface="新細明體"/>
                  <a:font script="Arab" typeface="Times New Roman"/>
                  <a:font script="Hebr" typeface="Times New Roman"/>
                  <a:font script="Thai" typeface="Angsana New"/>
                  <a:font script="Ethi" typeface="Nyala"/>
                  <a:font script="Beng" typeface="Vrinda"/>
                  <a:font script="Gujr" typeface="Shruti"/>
                  <a:font script="Khmr" typeface="MoolBoran"/>
                  <a:font script="Knda" typeface="Tunga"/>
                  <a:font script="Guru" typeface="Raavi"/>
                  <a:font script="Cans" typeface="Euphemia"/>
                  <a:font script="Cher" typeface="Plantagenet Cherokee"/>
                  <a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
                  <a:font script="Tibt" typeface="Microsoft Himalaya"/>
                  <a:font script="Thaa" typeface="MV Boli"/>
                  <a:font script="Deva" typeface="Mangal"/>
                  <a:font script="Telu" typeface="Gautami"/>
                  <a:font script="Taml" typeface="Latha"/>
                  <a:font script="Syrc" typeface="Estrangelo Edessa"/>
                  <a:font script="Orya" typeface="Kalinga"/>
                  <a:font script="Mlym" typeface="Kartika"/>
                  <a:font script="Laoo" typeface="DokChampa"/>
                  <a:font script="Sinh" typeface="Iskoola Pota"/>
                  <a:font script="Mong" typeface="Mongolian Baiti"/>
                  <a:font script="Viet" typeface="Times New Roman"/>
                  <a:font script="Uigh" typeface="Microsoft Uighur"/>
                </a:majorFont>
                <a:minorFont>
                  <a:latin typeface="Calibri"/>
                  <a:ea typeface=""/>
                  <a:cs typeface=""/>
                  <a:font script="Jpan" typeface="MS 明朝"/>
                  <a:font script="Hang" typeface="맑은 고딕"/>
                  <a:font script="Hans" typeface="宋体"/>
                  <a:font script="Hant" typeface="新細明體"/>
                  <a:font script="Arab" typeface="Arial"/>
                  <a:font script="Hebr" typeface="Arial"/>
                  <a:font script="Thai" typeface="Cordia New"/>
                  <a:font script="Ethi" typeface="Nyala"/>
                  <a:font script="Beng" typeface="Vrinda"/>
                  <a:font script="Gujr" typeface="Shruti"/>
                  <a:font script="Khmr" typeface="DaunPenh"/>
                  <a:font script="Knda" typeface="Tunga"/>
                  <a:font script="Guru" typeface="Raavi"/>
                  <a:font script="Cans" typeface="Euphemia"/>
                  <a:font script="Cher" typeface="Plantagenet Cherokee"/>
                  <a:font script="Yiii" typeface="Microsoft Yi Baiti"/>
                  <a:font script="Tibt" typeface="Microsoft Himalaya"/>
                  <a:font script="Thaa" typeface="MV Boli"/>
                  <a:font script="Deva" typeface="Mangal"/>
                  <a:font script="Telu" typeface="Gautami"/>
                  <a:font script="Taml" typeface="Latha"/>
                  <a:font script="Syrc" typeface="Estrangelo Edessa"/>
                  <a:font script="Orya" typeface="Kalinga"/>
                  <a:font script="Mlym" typeface="Kartika"/>
                  <a:font script="Laoo" typeface="DokChampa"/>
                  <a:font script="Sinh" typeface="Iskoola Pota"/>
                  <a:font script="Mong" typeface="Mongolian Baiti"/>
                  <a:font script="Viet" typeface="Arial"/>
                  <a:font script="Uigh" typeface="Microsoft Uighur"/>
                </a:minorFont>
              </a:fontScheme>
              <a:fmtScheme name="Office">
                <a:fillStyleLst>
                  <a:solidFill>
                    <a:schemeClr val="phClr"/>
                  </a:solidFill>
                  <a:gradFill rotWithShape="1">
                    <a:gsLst>
                      <a:gs pos="0">
                        <a:schemeClr val="phClr">
                          <a:tint val="50000"/>
                          <a:satMod val="300000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="35000">
                        <a:schemeClr val="phClr">
                          <a:tint val="37000"/>
                          <a:satMod val="300000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="100000">
                        <a:schemeClr val="phClr">
                          <a:tint val="15000"/>
                          <a:satMod val="350000"/>
                        </a:schemeClr>
                      </a:gs>
                    </a:gsLst>
                    <a:lin ang="16200000" scaled="1"/>
                  </a:gradFill>
                  <a:gradFill rotWithShape="1">
                    <a:gsLst>
                      <a:gs pos="0">
                        <a:schemeClr val="phClr">
                          <a:shade val="51000"/>
                          <a:satMod val="130000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="80000">
                        <a:schemeClr val="phClr">
                          <a:shade val="93000"/>
                          <a:satMod val="130000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="100000">
                        <a:schemeClr val="phClr">
                          <a:shade val="94000"/>
                          <a:satMod val="135000"/>
                        </a:schemeClr>
                      </a:gs>
                    </a:gsLst>
                    <a:lin ang="16200000" scaled="0"/>
                  </a:gradFill>
                </a:fillStyleLst>
                <a:lnStyleLst>
                  <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr">
                    <a:solidFill>
                      <a:schemeClr val="phClr">
                        <a:shade val="95000"/>
                        <a:satMod val="105000"/>
                      </a:schemeClr>
                    </a:solidFill>
                    <a:prstDash val="solid"/>
                  </a:ln>
                  <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr">
                    <a:solidFill>
                      <a:schemeClr val="phClr"/>
                    </a:solidFill>
                    <a:prstDash val="solid"/>
                  </a:ln>
                  <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr">
                    <a:solidFill>
                      <a:schemeClr val="phClr"/>
                    </a:solidFill>
                    <a:prstDash val="solid"/>
                  </a:ln>
                </a:lnStyleLst>
                <a:effectStyleLst>
                  <a:effectStyle>
                    <a:effectLst>
                      <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0">
                        <a:srgbClr val="000000">
                          <a:alpha val="38000"/>
                        </a:srgbClr>
                      </a:outerShdw>
                    </a:effectLst>
                  </a:effectStyle>
                  <a:effectStyle>
                    <a:effectLst>
                      <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
                        <a:srgbClr val="000000">
                          <a:alpha val="35000"/>
                        </a:srgbClr>
                      </a:outerShdw>
                    </a:effectLst>
                  </a:effectStyle>
                  <a:effectStyle>
                    <a:effectLst>
                      <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0">
                        <a:srgbClr val="000000">
                          <a:alpha val="35000"/>
                        </a:srgbClr>
                      </a:outerShdw>
                    </a:effectLst>
                    <a:scene3d>
                      <a:camera prst="orthographicFront">
                        <a:rot lat="0" lon="0" rev="0"/>
                      </a:camera>
                      <a:lightRig rig="threePt" dir="t">
                        <a:rot lat="0" lon="0" rev="1200000"/>
                      </a:lightRig>
                    </a:scene3d>
                    <a:sp3d>
                      <a:bevelT w="63500" h="25400"/>
                    </a:sp3d>
                  </a:effectStyle>
                </a:effectStyleLst>
                <a:bgFillStyleLst>
                  <a:solidFill>
                    <a:schemeClr val="phClr"/>
                  </a:solidFill>
                  <a:gradFill rotWithShape="1">
                    <a:gsLst>
                      <a:gs pos="0">
                        <a:schemeClr val="phClr">
                          <a:tint val="40000"/>
                          <a:satMod val="350000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="40000">
                        <a:schemeClr val="phClr">
                          <a:tint val="45000"/>
                          <a:shade val="99000"/>
                          <a:satMod val="350000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="100000">
                        <a:schemeClr val="phClr">
                          <a:shade val="20000"/>
                          <a:satMod val="255000"/>
                        </a:schemeClr>
                      </a:gs>
                    </a:gsLst>
                    <a:path path="circle">
                      <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/>
                    </a:path>
                  </a:gradFill>
                  <a:gradFill rotWithShape="1">
                    <a:gsLst>
                      <a:gs pos="0">
                        <a:schemeClr val="phClr">
                          <a:tint val="80000"/>
                          <a:satMod val="300000"/>
                        </a:schemeClr>
                      </a:gs>
                      <a:gs pos="100000">
                        <a:schemeClr val="phClr">
                          <a:shade val="30000"/>
                          <a:satMod val="200000"/>
                        </a:schemeClr>
                      </a:gs>
                    </a:gsLst>
                    <a:path path="circle">
                      <a:fillToRect l="50000" t="50000" r="50000" b="50000"/>
                    </a:path>
                  </a:gradFill>
                </a:bgFillStyleLst>
              </a:fmtScheme>
            </a:themeElements>
            <a:objectDefaults/>
            <a:extraClrSchemeLst/>
          </a:theme>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/settings.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml">
        <pkg:xmlData>
          <w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main">
            <w:zoom w:percent="100"/>
            <w:defaultTabStop w:val="720"/>
            <w:characterSpacingControl w:val="doNotCompress"/>
            <w:compat>
              <w:useFELayout/>
            </w:compat>
            <w:rsids>
              <w:rsidRoot w:val="000B50AA"/>
              <w:rsid w:val="000B50AA"/>
              <w:rsid w:val="000E30D5"/>
              <w:rsid w:val="00262153"/>
              <w:rsid w:val="00C507F1"/>
            </w:rsids>
            <m:mathPr>
              <m:mathFont m:val="Cambria Math"/>
              <m:brkBin m:val="before"/>
              <m:brkBinSub m:val="--"/>
              <m:smallFrac m:val="off"/>
              <m:dispDef/>
              <m:lMargin m:val="0"/>
              <m:rMargin m:val="0"/>
              <m:defJc m:val="centerGroup"/>
              <m:wrapIndent m:val="1440"/>
              <m:intLim m:val="subSup"/>
              <m:naryLim m:val="undOvr"/>
            </m:mathPr>
            <w:themeFontLang w:val="en-US"/>
            <w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink"/>
            <w:shapeDefaults>
              <o:shapedefaults v:ext="edit" spidmax="3074"/>
              <o:shapelayout v:ext="edit">
                <o:idmap v:ext="edit" data="1"/>
              </o:shapelayout>
            </w:shapeDefaults>
            <w:decimalSymbol w:val="."/>
            <w:listSeparator w:val=","/>
          </w:settings>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/fontTable.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml">
        <pkg:xmlData>
          <w:fonts xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
            <w:font w:name="Calibri">
              <w:panose1 w:val="020F0502020204030204"/>
              <w:charset w:val="00"/>
              <w:family w:val="swiss"/>
              <w:pitch w:val="variable"/>
              <w:sig w:usb0="A00002EF" w:usb1="4000207B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/>
            </w:font>
            <w:font w:name="Times New Roman">
              <w:panose1 w:val="02020603050405020304"/>
              <w:charset w:val="00"/>
              <w:family w:val="roman"/>
              <w:pitch w:val="variable"/>
              <w:sig w:usb0="20002A87" w:usb1="80000000" w:usb2="00000008" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000"/>
            </w:font>
            <w:font w:name="Cambria">
              <w:panose1 w:val="02040503050406030204"/>
              <w:charset w:val="00"/>
              <w:family w:val="roman"/>
              <w:pitch w:val="variable"/>
              <w:sig w:usb0="A00002EF" w:usb1="4000004B" w:usb2="00000000" w:usb3="00000000" w:csb0="0000009F" w:csb1="00000000"/>
            </w:font>
          </w:fonts>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/webSettings.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml">
        <pkg:xmlData>
          <w:webSettings xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
            <w:optimizeForBrowser/>
          </w:webSettings>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/docProps/app.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" pkg:padding="256">
        <pkg:xmlData>
          <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
            <Template>Normal.dotm</Template>
            <TotalTime>0</TotalTime>
            <Pages>1</Pages>
            <Words>0</Words>
            <Characters>3</Characters>
            <Application>Microsoft Office Word</Application>
            <DocSecurity>0</DocSecurity>
            <Lines>1</Lines>
            <Paragraphs>1</Paragraphs>
            <ScaleCrop>false</ScaleCrop>
            <Company>Microsoft</Company>
            <LinksUpToDate>false</LinksUpToDate>
            <CharactersWithSpaces>3</CharactersWithSpaces>
            <SharedDoc>false</SharedDoc>
            <HyperlinksChanged>false</HyperlinksChanged>
            <AppVersion>12.0000</AppVersion>
          </Properties>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/docProps/core.xml" pkg:contentType="application/vnd.openxmlformats-package.core-properties+xml" pkg:padding="256">
        <pkg:xmlData>
          <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <dc:title/>
            <dc:subject/>
            <dc:creator>Manjunath Khatawkar</dc:creator>
            <cp:keywords/>
            <dc:description/>
            <cp:lastModifiedBy>Manjunath Khatawkar</cp:lastModifiedBy>
            <cp:revision>2</cp:revision>
            <dcterms:created xsi:type="dcterms:W3CDTF">2008-05-06T17:59:00Z</dcterms:created>
            <dcterms:modified xsi:type="dcterms:W3CDTF">2008-05-06T17:59:00Z</dcterms:modified>
          </cp:coreProperties>
        </pkg:xmlData>
      </pkg:part>
      <pkg:part pkg:name="/word/styles.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml">
        <pkg:xmlData>
          <w:styles xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
            <w:docDefaults>
              <w:rPrDefault>
                <w:rPr>
                  <w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorEastAsia" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi"/>
                  <w:sz w:val="22"/>
                  <w:szCs w:val="22"/>
                  <w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="ar-SA"/>
                </w:rPr>
              </w:rPrDefault>
              <w:pPrDefault>
                <w:pPr>
                  <w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
                </w:pPr>
              </w:pPrDefault>
            </w:docDefaults>
            <w:latentStyles w:defLockedState="0" w:defUIPriority="99" w:defSemiHidden="1" w:defUnhideWhenUsed="1" w:defQFormat="0" w:count="267">
              <w:lsdException w:name="Normal" w:semiHidden="0" w:uiPriority="0" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="heading 1" w:semiHidden="0" w:uiPriority="9" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="heading 2" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 3" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 4" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 5" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 6" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 7" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 8" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="heading 9" w:uiPriority="9" w:qFormat="1"/>
              <w:lsdException w:name="toc 1" w:uiPriority="39"/>
              <w:lsdException w:name="toc 2" w:uiPriority="39"/>
              <w:lsdException w:name="toc 3" w:uiPriority="39"/>
              <w:lsdException w:name="toc 4" w:uiPriority="39"/>
              <w:lsdException w:name="toc 5" w:uiPriority="39"/>
              <w:lsdException w:name="toc 6" w:uiPriority="39"/>
              <w:lsdException w:name="toc 7" w:uiPriority="39"/>
              <w:lsdException w:name="toc 8" w:uiPriority="39"/>
              <w:lsdException w:name="toc 9" w:uiPriority="39"/>
              <w:lsdException w:name="caption" w:uiPriority="35" w:qFormat="1"/>
              <w:lsdException w:name="Title" w:semiHidden="0" w:uiPriority="10" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Default Paragraph Font" w:uiPriority="1"/>
              <w:lsdException w:name="Subtitle" w:semiHidden="0" w:uiPriority="11" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Strong" w:semiHidden="0" w:uiPriority="22" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Emphasis" w:semiHidden="0" w:uiPriority="20" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Table Grid" w:semiHidden="0" w:uiPriority="59" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Placeholder Text" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="No Spacing" w:semiHidden="0" w:uiPriority="1" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Light Shading" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 1" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 1" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 1" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 1" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 1" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 1" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Revision" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="List Paragraph" w:semiHidden="0" w:uiPriority="34" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Quote" w:semiHidden="0" w:uiPriority="29" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Intense Quote" w:semiHidden="0" w:uiPriority="30" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Medium List 2 Accent 1" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 1" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 1" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 1" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 1" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 1" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 1" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 1" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 2" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 2" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 2" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 2" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 2" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 2" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2 Accent 2" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 2" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 2" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 2" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 2" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 2" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 2" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 2" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 3" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 3" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 3" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 3" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 3" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 3" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2 Accent 3" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 3" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 3" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 3" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 3" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 3" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 3" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 3" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 4" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 4" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 4" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 4" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 4" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 4" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2 Accent 4" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 4" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 4" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 4" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 4" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 4" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 4" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 4" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 5" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 5" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 5" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 5" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 5" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 5" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2 Accent 5" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 5" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 5" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 5" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 5" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 5" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 5" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 5" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Shading Accent 6" w:semiHidden="0" w:uiPriority="60" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light List Accent 6" w:semiHidden="0" w:uiPriority="61" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Light Grid Accent 6" w:semiHidden="0" w:uiPriority="62" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 1 Accent 6" w:semiHidden="0" w:uiPriority="63" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Shading 2 Accent 6" w:semiHidden="0" w:uiPriority="64" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 1 Accent 6" w:semiHidden="0" w:uiPriority="65" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium List 2 Accent 6" w:semiHidden="0" w:uiPriority="66" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 1 Accent 6" w:semiHidden="0" w:uiPriority="67" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 2 Accent 6" w:semiHidden="0" w:uiPriority="68" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Medium Grid 3 Accent 6" w:semiHidden="0" w:uiPriority="69" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Dark List Accent 6" w:semiHidden="0" w:uiPriority="70" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Shading Accent 6" w:semiHidden="0" w:uiPriority="71" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful List Accent 6" w:semiHidden="0" w:uiPriority="72" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Colorful Grid Accent 6" w:semiHidden="0" w:uiPriority="73" w:unhideWhenUsed="0"/>
              <w:lsdException w:name="Subtle Emphasis" w:semiHidden="0" w:uiPriority="19" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Intense Emphasis" w:semiHidden="0" w:uiPriority="21" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Subtle Reference" w:semiHidden="0" w:uiPriority="31" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Intense Reference" w:semiHidden="0" w:uiPriority="32" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Book Title" w:semiHidden="0" w:uiPriority="33" w:unhideWhenUsed="0" w:qFormat="1"/>
              <w:lsdException w:name="Bibliography" w:uiPriority="37"/>
              <w:lsdException w:name="TOC Heading" w:uiPriority="39" w:qFormat="1"/>
            </w:latentStyles>
            <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
              <w:name w:val="Normal"/>
              <w:qFormat/>
              <w:rsid w:val="00262153"/>
            </w:style>
            <w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont">
              <w:name w:val="Default Paragraph Font"/>
              <w:uiPriority w:val="1"/>
              <w:semiHidden/>
              <w:unhideWhenUsed/>
            </w:style>
            <w:style w:type="table" w:default="1" w:styleId="TableNormal">
              <w:name w:val="Normal Table"/>
              <w:uiPriority w:val="99"/>
              <w:semiHidden/>
              <w:unhideWhenUsed/>
              <w:qFormat/>
              <w:tblPr>
                <w:tblInd w:w="0" w:type="dxa"/>
                <w:tblCellMar>
                  <w:top w:w="0" w:type="dxa"/>
                  <w:left w:w="108" w:type="dxa"/>
                  <w:bottom w:w="0" w:type="dxa"/>
                  <w:right w:w="108" w:type="dxa"/>
                </w:tblCellMar>
              </w:tblPr>
            </w:style>
            <w:style w:type="numbering" w:default="1" w:styleId="NoList">
              <w:name w:val="No List"/>
              <w:uiPriority w:val="99"/>
              <w:semiHidden/>
              <w:unhideWhenUsed/>
            </w:style>
          </w:styles>
        </pkg:xmlData>
      </pkg:part>
    </pkg:package>

     

    This is beautiful man! all the parts and relationships clubbed nicely in one XML file!

    While I was still looking and appreciating the beauty of this design decision, Manju already fought his way to create a actual package by parsing this file and sent me the code snippet -

    XPathDocument xpathDocument = new XPathDocument(new StringReader(openXml));
                XPathNavigator navigator = xpathDocument.CreateNavigator();
    
                XmlNamespaceManager namespaceManager = GetContentControlNamespaceManager(navigator);
                XPathNodeIterator iterator = navigator.Select("//pkg:part", namespaceManager);
    
                Package pkg = Package.Open(Environment.CurrentDirectory + @"/abc.docx", FileMode.Create);
    
                while (iterator.MoveNext())
                {
                    Uri partUri = new Uri(iterator.Current.GetAttribute("name", "http://schemas.microsoft.com/office/2006/xmlPackage"), UriKind.Relative);
    
                    if (pkg.PartExists(partUri))
                        pkg.DeletePart(partUri);
    
                    PackagePart part = pkg.CreatePart(
                                        partUri
                                        , iterator.Current.GetAttribute("contentType", "http://schemas.microsoft.com/office/2006/xmlPackage"));
    
                    string a = iterator.Current.InnerXml
                        .Replace("<pkg:xmlData xmlns:pkg=\"http://schemas.microsoft.com/office/2006/xmlPackage\">", "")
                        .Replace(@"</pkg:xmlData>", "");
                    byte[] buffer = Encoding.UTF8.GetBytes(a);
                    part.GetStream().Write(buffer, 0, buffer.Length);
                }
    
                
                pkg.Flush();

    Good one, can be done in a few more ways – but this worked for manju, You can use it as well. In the next part, I’ll try to do the opposite, create this XML file from the Package, without automation.

    Test for you – do you think you can easily write code for converting the sample in previous post to match Word XML file format?

     



     

    Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

  • Pranav ... Blogging

    Open XML for primary school goers

    • 3 Comments

    Ok ..I agree! I was not a simple-sober-studious-obedient-goodie-good student.

    I do remember when I was a primary school goer, whenever me or any of my friends wanted a leave, we almost always used the same letter template, just modifying a few fields.

    Yesterday, I was thinking about this. While working on an Open XML issue and thought of creating a sample which primary school goers can use to generate application templates.

    This sample just takes the fields that you are finally going to modify and creates the application docx for you. Oh .. well it will also demonstrate how to modify CustomXML attached to a docx file.

     

    Here is it. Have fun -

     

     

    Imports System.IO
    Imports System.IO.Packaging
    Imports System.Xml
    Public Class AddFields

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
    Me.Close()
    End Sub

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    Dim fieldscollection As New Collection
    fieldscollection.Add(AddressTo.Text, "AddressTo")
    fieldscollection.Add(Place.Text, "Place")
    fieldscollection.Add(Teacher.Text, "Teacher")
    fieldscollection.Add(Sickness.Text, "Sickness")
    fieldscollection.Add(TimeFrame.Text, "TimeFrame")
    fieldscollection.Add(Days.Text, "Days")
    fieldscollection.Add(StudentName.Text, "StudentName")
    fieldscollection.Add(Dated.Text, "Dated")
    UpdateXML(fieldscollection)

    End Sub

    Public Sub UpdateXML(ByRef fs As Collection)

    ' Given a file name, retrieve the officeDocument part.
    Dim fileName As String = "C:\Users\username\Desktop\test\application.docx"

    Const documentRelationshipType As String = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
    Const customRelationshipType As String = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"

    ' Open the package with read/write access.
    Using myPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite)
    ' Get the main document part (workbook.xml, document.xml, presentation.xml).
    For Each relationship As PackageRelationship In myPackage.GetRelationshipsByType(documentRelationshipType)
    ' There should only be one document part in the package.
    Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), relationship.TargetUri)
    Dim documentPart As PackagePart = myPackage.GetPart(documentUri)
    Dim customPart As PackagePart = Nothing 'declare a custom part
    'Get the custom xml part
    For Each crelation As PackageRelationship In documentPart.GetRelationshipsByType(customRelationshipType)
    'There should be only one customxml part in the package
    Dim customUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), crelation.TargetUri)
    customPart = myPackage.GetPart(customUri)
    Exit For
    Next

    Dim customDoc As XmlDocument = New XmlDocument()
    customDoc.Load(customPart.GetStream())
    'Update XML
    customDoc.SelectSingleNode("/root/addressto").InnerXml = fs.Item("AddressTo")
    customDoc.SelectSingleNode("/root/place").InnerXml = fs.Item("Place")
    customDoc.SelectSingleNode("/root/teacher").InnerXml = fs.Item("Teacher")
    customDoc.SelectSingleNode("/root/sickness").InnerXml = fs.Item("Sickness")
    customDoc.SelectSingleNode("/root/timeframe").InnerXml = fs.Item("TimeFrame")
    customDoc.SelectSingleNode("/root/days").InnerXml = fs.Item("Days")
    customDoc.SelectSingleNode("/root/name").InnerXml = fs.Item("StudentName")
    customDoc.SelectSingleNode("/root/date").InnerXml = fs.Item("Dated")


    ' Save the modified customxml back into its part.
    customDoc.Save(customPart.GetStream(FileMode.Create, FileAccess.ReadWrite))


    ' Only one customXML part, so get out now.
    Exit For
    Next
    myPackage.Flush()
    myPackage.Close()
    End Using
    MsgBox("Done!")
    End Sub


    End Class

     

    docx that it modifies is also attached to the post.

     

     


     

    Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn't do it. Enjoy.

Page 1 of 1 (5 items)