none
XML paragraph code to an existing word docx file using open xml sdk 2.0 RRS feed

  • Question

  • How to add a XML paragraph code to an existing word docx file using open xml sdk 2.0 in .net

    <w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
        <w:pPr>
            <w:jc w:val="left" />
        </w:pPr>
        <w:r>
            <w:rPr>
                <w:color w:val="auto" />
                <w:b />
                <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
                <w:sz w:val="28" />
            </w:rPr>
            <w:t>Hello World</w:t>
        </w:r>
    </w:p>

    can it be done using AddCustomXmlPart or AddNewPart<CustomXmlPart>()

    Regards

     

    Wednesday, July 14, 2010 3:13 PM

Answers

  • Hi dotnetcoder2010,
       
    Welcome to Microsoft Office for Developers
     forum! I'm glad to see your active participation and discussion in Microsoft Office for Developers forum. Based on your above describing content I suggest you refer to link below: http://msdn.microsoft.com/en-us/bb608597.aspx

     Hope this will help you!  If you still have any doubt and concern about this issue, please let me know. If I misunderstood you, please kindly elaborate your question. 


    Please Mark as Answered If this is helpful Or Un-Mark as Answered if it is not helpful.

    Best Regards,
    Yan Jun
    Microsoft Online Community Support

    Monday, July 19, 2010 3:43 AM
    Moderator
  • I looked in DocumentReflector (C:\Program Files\Open XML Format SDK\V2.0\tools) and got this code for one of paragraph

    public static Paragraph GenerateParagraph()
            {
                var element =
                    new Paragraph(
                        new ParagraphProperties(
                            new ParagraphMarkRunProperties(
                                new Languages(){ Val = "en-US" })),
                        new Run(
                            new RunProperties(
                                new Languages(){ Val = "en-US" }),
                            new Text("aaa"))
                    ){ RsidParagraphMarkRevision = "00AB0A80", RsidParagraphAddition = "00EA4BB8", RsidRunAdditionDefault = "00AB0A80" };
                return element;
            }

    maybe it'll help you
    Monday, July 19, 2010 4:08 AM

All replies

  • Hi dotnetcoder2010,
       
    Welcome to Microsoft Office for Developers
     forum! I'm glad to see your active participation and discussion in Microsoft Office for Developers forum. Based on your above describing content I suggest you refer to link below: http://msdn.microsoft.com/en-us/bb608597.aspx

     Hope this will help you!  If you still have any doubt and concern about this issue, please let me know. If I misunderstood you, please kindly elaborate your question. 


    Please Mark as Answered If this is helpful Or Un-Mark as Answered if it is not helpful.

    Best Regards,
    Yan Jun
    Microsoft Online Community Support

    Monday, July 19, 2010 3:43 AM
    Moderator
  • I looked in DocumentReflector (C:\Program Files\Open XML Format SDK\V2.0\tools) and got this code for one of paragraph

    public static Paragraph GenerateParagraph()
            {
                var element =
                    new Paragraph(
                        new ParagraphProperties(
                            new ParagraphMarkRunProperties(
                                new Languages(){ Val = "en-US" })),
                        new Run(
                            new RunProperties(
                                new Languages(){ Val = "en-US" }),
                            new Text("aaa"))
                    ){ RsidParagraphMarkRevision = "00AB0A80", RsidParagraphAddition = "00EA4BB8", RsidRunAdditionDefault = "00AB0A80" };
                return element;
            }

    maybe it'll help you
    Monday, July 19, 2010 4:08 AM