OpenXML v2是痛苦的.为什么我不能创建一个项目列表?

本文关键字:一个 项目 列表 创建 痛苦 v2 为什么 不能 OpenXML | 更新日期: 2023-09-27 18:05:27

一个应该创建一个编号列表,另一个应该创建一个项目符号列表,如图所示

http://sharepointweblog.blogspot.com/2009/07/open-xml-insert-bullets-and-numbering.html

但两者都有编号…为什么?

也. .用openXML编程创建word文档看起来非常痛苦。有没有什么好的参考资料可以帮助解释如何创建一个基本的word文档?(一些文字,一些要点)…

Paragraph paraBullet1 = new Paragraph(
              new ParagraphProperties(
              new ParagraphStyleId() { Val = "ListParagraph" },
              new NumberingProperties(
                                      new NumberingLevelReference() { Val = 0 },
                                      new NumberingId() { Val = 1 })),
                                      new Run(new Text("List 1"))
                                      ) { RsidParagraphAddition = "005F3962", RsidParagraphProperties = "00330DA9", RsidRunAdditionDefault = "00330DA9" };
Paragraph paraTest2 = body.AppendChild(paraBullet1);
Paragraph paraBullet2 = new Paragraph(
             new ParagraphProperties(
             new ParagraphStyleId() { Val = "ListParagraph" },
             new NumberingProperties(
                                     new NumberingLevelReference() { Val = 0 },
                                     new NumberingId() { Val = 2 })),
                                     new Run(new Text("List 2"))
                                     ) { RsidParagraphAddition = "00031711", RsidParagraphProperties = "00031711", RsidRunAdditionDefault = "00031711" };
Paragraph paraTest2x = body.AppendChild(paraBullet2);

OpenXML v2是痛苦的.为什么我不能创建一个项目列表?

从这个问题中寻找David Yates的答案。他成功了。他的解决方案要求您使用不止一个子弹,但是他的helper类可以工作。我也有同样的问题。如果没有正确设置numbers .xml,则编号列表似乎是默认的(将.doc重命名为.zip并查看xml)。

http://stackoverflow.com/questions/1940911/openxml-2-sdk-word-document-create-bulleted-list-programmatically