wordpress hit counter
Welcome to OpenXML Developer Sign in | Join | Help

creating WordML document using OpenXml

Last post 03-03-2009, 5:02 AM by friedrichsklenar. 6 replies.
Sort Posts: Previous Next
  •  02-06-2009, 8:31 AM 4031

    creating WordML document using OpenXml

    Can anyone tell me how to create WordML document using OpenXml SDK(c#.net)?


  •  02-07-2009, 3:27 AM 4032 in reply to 4031

    Re: creating WordML document using OpenXml

    i tried with my code.But during the file creation its writing some junk values in the file.i m using Microsoft Windows Professional version 2002 service pack 2.What would be the solution for this problem?
  •  02-08-2009, 3:31 PM 4038 in reply to 4032

    Re: creating WordML document using OpenXml

    Mano. Could you provide a bit more detail please? A little confused by the version numbers you gave. Can you please advise 1. Which version of the Open XML Format SDK you are using 2. Which version of .NET you are attempting to use 3. Which version of Microsoft Office (or any other client) you are trying to open the file in. If you feel comfortable please also feel free to post some code showing your issue. Thanks Chris
  •  02-08-2009, 10:56 PM 4049 in reply to 4038

    Re: creating WordML document using OpenXml

    thank u for responding  Chris.I have given below the details u need
    1.OpenXml SDK version 2.0
    2..Net framework3.5
    3.Microsoft office 2003
    code:
    public static void CreateWordMLDocument(string docName)

            {
                // Create a Wordprocessing document.
               using (WordprocessingDocument package = WordprocessingDocument.Create(docName, DocumentFormat.OpenXml.WordprocessingDocumentType.Document))
               {
                    // Add a new main document part.
                    package.AddMainDocumentPart();
                    // Create the Document DOM.
                    package.MainDocumentPart.Document =
                        new Document(
                            new Body(
                                new Paragraph(
                                    new Run(
                                        new Text("Hello World!")))));
                    // Save changes to the main document part.
                    package.MainDocumentPart.Document.Save();
                   }
                }
            static void Main(string[] args)
            {
                CreateWordMLDocument("Mydoc.xml");

            }

    this is the output i m getting ....
    Mydoc.xml:

    PK    jnG:žF%Õþ   Ç     word/document.xml ¢ (                      í½`I–%&/mÊ{JõJ×àt¡€`$ؐ@ìÁˆÍæ’ìiG#)«*ÊeVe]f@Ì흼÷Þ{ï½÷Þ{ï½÷º;N'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?"þÇ¿÷|ü{¼[”ée^7Eµüì£ÝñÎGi¾œV³byñÙGëö|ûà£ßãèñÕ£Y5]/òe›Rûeóè곏æm»zt÷n3ç‹¬W«|IߝWõ"kéÏúâîUUÏVu5Í›†À-Ê»{;;ŸÞ]dÅò#€œT³kü\áŸÿ´GßÎ˲J¿[Õåìw}|Ÿàßšÿ]ñ¿òÖ]‡ÑÑÿPK
         jnG:7šö›*  *   _rels/.rels ¢ (                      <?xml version="1.0" encoding="utf-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="/word/document.xml" Id="R1aa4a88f31c14a97" /></Relationships>PK
         jnG:ßWZ  Z    [Content_Types].xml ¢ (                      <?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" /><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /></Types>PK-     jnG:žF%Õþ   Ç                    word/document.xmlPK-
         jnG:7šö›*  *               I  _rels/.relsPK-
         jnG:ßWZ  Z               ¸  [Content_Types].xmlPK      ¹   _   
  •  02-08-2009, 11:16 PM 4050 in reply to 4049

    Re: creating WordML document using OpenXml

    hi..Chris..
    I downloaded the compatibility pack for office 2007 and specified the file format in docx extension.So i got the desired output now.
    Now my doubt is..will i be able create a wordML document supporting Office 2003 using OpenXmlSDK2.0?
  •  02-13-2009, 3:33 AM 4086 in reply to 4050

    Re: creating WordML document using OpenXml

    Hi Mano,

    Word 2003 does not support Open XML File Format.

    you may refer to this for more info.

  •  03-03-2009, 5:02 AM 4202 in reply to 4031

    Re: creating WordML document using OpenXml

    Hi mano,

    you could use the software solution TDIWiz (www.tdiwiz.com) to accomplish your task. It enables to create Word documents programmatically (2003 format as well as 2007) without own programming.

View as RSS news feed in XML