本文介绍了如何找到Word段落的页码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试解析Word文档,而我正在寻找的信息应仅位于第一页上.有什么方法可以获取段落的页码吗?
I am trying to parse a Word document and the information I am looking for should be located on the first page only. Is there any way to get the page number for a paragraph?
foreach (Word.Paragraph p in document.Paragraphs)
{
// pageNo = .....
// if(pageNo == 1 && p.Range.Text.StartsWith("This")) {
// /* do some processing with the paragraph */
// }
}
推荐答案
此帖子我确定您可以从该段中找到Range!
And from this post, how to detect Empty paragraph in Word Document using Microsoft.Office.Interop.Word in C#4.0? i am sure u could find the Range from the paragraph!
for each p in Doc.Content.Paragraphs
if (p.Range.End - p.Range.Start) > 1 then (The paragraph is empty)
Next
我敢打赌,您应该结合两个答案来解决您的问题!
you should have your solution combining both the answers, i bet!
这篇关于如何找到Word段落的页码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!