Inserting newlines in Word using OpenXML

前端 未结 4 592
轻奢々
轻奢々 2020-11-30 04:34

I am using openxml WordProcessingDocument to open a Word template and replace placeholder x1 with a string. This works fine unless I need the string to contain a newline.

4条回答
  •  执念已碎
    2020-11-30 05:08

    Altough this question is already answered I have another approach to solve questions like :

    How can I make XXX with OpenXML??

    In this cases you could make use of the powerful Microsoft OpenXML productivity tool (also known as OpenXmlSdkTool). Download here.

    1. Create a new office document
    2. Add the parts to the document which you would like to reproduce with OpenXML SDK.
    3. Open the office document with Microsoft OpenXML productivity tool
    4. Click on "Reflect Code"
    5. On the right side you will see now you document reflected into C# code.

提交回复
热议问题