无法使用OpenXML读取word文档的实际自动编号 [英] Not able to read actual auto numbers of word document using OpenXML

查看:395
本文介绍了无法使用OpenXML读取word文档的实际自动编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们在应用程序中使用openXML来读取word文档内容。在我们开始阅读实际文档内容之前,我们使用openxml FormattingAssembler类(https://github.com/VisualOn/OpenXmlPowerTools-old/blob/master/FormattingAssembler.cs)和ListItemRetriver
类(https:// github)的.com /视龙/ OpenXmlPowerTools岁/斑点/主/ ListItemRetriever.cs) 阅读列表编号/文件的自动编号。 
$


我有一个文件,在分节后,自动编号从1重置,但即使数字重置,Open xml正在连续读取自动数字。



例如:第一部分中的最后一个自动数字在分段中断后为2,即使它是从1个OpenXML读取开始它为3.



有什么方法可以让我们如何在分节后重置自动数字或如何在分节后读取文件的实际自动编号?



谢谢,

Gayatri

Hi,

We use openXML in our application to read the word document content. And before we start to read actual document content we use openxml FormattingAssembler class(https://github.com/VisualOn/OpenXmlPowerTools-old/blob/master/FormattingAssembler.cs) and ListItemRetriver class (https://github.com/VisualOn/OpenXmlPowerTools-old/blob/master/ListItemRetriever.cs)  to read the list numbers/Auto numbers of the document. 

I have a document where after section break the auto numbers are resetting from 1 but even though the numbers are reseted, Open xml is reading auto numbers continuously.

Ex : The last auto number in section one was 2 after section break even though it is starting from 1 OpenXML read it as 3.

Is there any way how we can make auto numbers to reset after section break or How to read the actual auto number of the document after section break ?

Thanks,
Gayatri

推荐答案

你好
GayatriK,

您曾问过,"有什么方法可以让我们如何在分节后重置自动数字或如何在分节后读取文件的实际自动编号?"

You had asked,"Is there any way how we can make auto numbers to reset after section break or How to read the actual auto number of the document after section break ?"

w:numId可以包含值0,这是一个特殊值表示在样式层次结构的此级别删除了编号。处理
此标记时,如果w:val ='0',则段落没有列表项。

The w:numId can contain a value of 0, which is a special value that indicates that numbering was removed at this level of the style hierarchy. While processing this markup, if the w:val='0', the paragraph does not have a list item.

所以在你的代码中,你需要找到这个numid值为0以重新开始编号。

So in your code, you need to find this numid value to 0 to restart the numbering.

参考:

使用Open XML WordprocessingML中的编号列表

定义特定级别 - 重新开始编号

免责声明:此响应包含对第三方万维网站点的引用。 Microsoft提供此信息是为了方便您。 Microsoft不控制这些网站,也未测试在这些网站上找到的任何软件或信息;因此,Microsoft不能就其中发现的任何软件或信息的质量,安全性或适用性做出任何陈述。使用互联网上的任何软件都存在固有的危险,并且Microsoft提醒您在从互联网上检索任何软件之前确保您完全了解风险的

Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

问候

Deepak

Deepak


这篇关于无法使用OpenXML读取word文档的实际自动编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆