OpenXML 2 SDK - Word document - Create bulleted list programmatically

前端 未结 4 1534
情深已故
情深已故 2020-12-23 14:53

Using the OpenXML SDK, 2.0 CTP, I am trying to programmatically create a Word document. In my document I have to insert a bulleted list, an some of the elements of the list

4条回答
  •  臣服心动
    2020-12-23 15:38

    And if you are like me - creating a document from a template, then you may want to use this code, to handle both situations - when your template does or does not contain any numbering definitions:

    // Introduce bulleted numbering in case it will be needed at some point
    NumberingDefinitionsPart numberingPart = document.MainDocumentPart.NumberingDefinitionsPart;
    if (numberingPart == null)
    {
        numberingPart = document.MainDocumentPart.AddNewPart("NumberingDefinitionsPart001");
    }
    

提交回复
热议问题