C#DocX:插入新编号列表继续编号
我正在尝试使用Novacode DocX将几个编号的列表插入到Word文档中 大概是这样的:C#DocX:插入新编号列表继续编号,c#,ms-word,openxml,novacode-docx,C#,Ms Word,Openxml,Novacode Docx,我正在尝试使用Novacode DocX将几个编号的列表插入到Word文档中 大概是这样的: var doc = DocX.Create("somedoc.docx"); var list = doc.AddList(listType: ListItemType.Numbered, startNumber: 1); doc.AddListItem(list, "Number 1", 0, listType); doc.AddListItem(list, "Number 2", 0, listT
var doc = DocX.Create("somedoc.docx");
var list = doc.AddList(listType: ListItemType.Numbered, startNumber: 1);
doc.AddListItem(list, "Number 1", 0, listType);
doc.AddListItem(list, "Number 2", 0, listType);
doc.InsertList(list);
doc.InsertParagraph(); //just to get some space between.
var secondList= doc.AddList(listType: ListItemType.Numbered, startNumber: 1);
doc.AddListItem(secondList, "Number 1", 0, listType);
doc.AddListItem(secondList, "Number 2", 0, listType);
doc.InsertList(secondList);
这就产生了:
有人知道可能是什么问题吗(除了DocX库中的bug)?我是在Word 2010中打开文档的,所以我的一个理论是,DocX和Word>2007存在一些不兼容之处。如果是这样的话,我可能必须在生成文档后处理XML。原来是Novacode.Docx中的一个bug。我提交了一个应用于1.0.0.16版的补丁,我发现了同样的问题。可能是novacode docx中的错误。