Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#DocX:插入新编号列表继续编号_C#_Ms Word_Openxml_Novacode Docx - Fatal编程技术网

C#DocX:插入新编号列表继续编号

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

我正在尝试使用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, 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);
这就产生了:

  • 第一
  • 二号
  • 第一
  • 二号
  • 我所期望的是:

  • 第一
  • 二号
  • 第一
  • 二号
  • startNumber参数似乎不起作用。在生成的文档的number.xml文件中,我可以看到NUMID和AbstractNUMID似乎都正确生成。这两个列表有不同的numid,每个都引用不同的抽象numid


    有人知道可能是什么问题吗(除了DocX库中的bug)?我是在Word 2010中打开文档的,所以我的一个理论是,DocX和Word>2007存在一些不兼容之处。如果是这样的话,我可能必须在生成文档后处理XML。

    原来是Novacode.Docx中的一个bug。我提交了一个应用于1.0.0.16版的补丁,我发现了同样的问题。可能是novacode docx中的错误。