简体   繁体   English

使用Open XML SDK从Word文档获取特定页面

[英]Get particular page from Word document using Open XML SDK

I want to convert each page of document into separate word document. 我想将文档的每一页转换成单独的Word文档。 So i need to get every page of document. 所以我需要获取文档的每一页。 I am not able to differentiate pages in open xml format. 我无法区分开放xml格式的页面。 So please move me to right direction. 因此,请向正确的方向移动。

 using (WordprocessingDocument document = WordprocessingDocument.Open("test.docx", true))
        {
            MainDocumentPart mainPart = document.MainDocumentPart;
}

Based on the documentation here , The client uses LastRenderedPageBreak toidentify pages when its last saved. 根据此处的文档,客户端将使用LastRenderedPageBreak上次保存页面的时间。 and the xml for it is: 和它的XML是:

<w:lastRenderedPageBreak/> 

I think you can use this to check and break pages unless the document you are working with is auto generated and haven't got any lastRenderedPageBreak s. 我认为您可以使用它来检查和中断页面,除非您正在使用的文档是自动生成的并且没有任何lastRenderedPageBreak

Also this approach will only work for documents with single column layouts. 同样,该方法仅适用于具有单列布局的文档。 But with documents with multi column layouts looks like there are issues. 但是对于具有多列布局的文档来说似乎存在问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用带有C#的开放XML SDK仅将页脚添加到Word文档的最后一页 - Add Footer only to last page of the word document using open XML sdk with C# 如何使用open xml sdk获取word文档的所有合并字段 - How to get all merge fields of word document using open xml sdk 如何使用类似 json 格式的 C# open-xml SDK 从 Word 文档中获取文本? - How to get text out of Word Document using C# open-xml SDK in json like format? 如何使用Open XML SDK获取特定图表的图表类型? - How to get chart type of a particular chart using Open XML SDK? 使用 Open XML 将数据表导出到带有页码的 Word 文档 - Export Datatable to Word Document With Page Numbers using Open XML 如何从 Word 文档中复制富文本内容控件的内容并使用 Open XML SDK 删除控件本身 - How to copy content of Rich Text Content Control from Word document and remove the control itself using Open XML SDK 我如何获得 <w:pict> 使用开放xml从Word文档中标记 - how i can get a <w:pict> tag from word document using open xml 使用Open XML SDK将图从EA导出到文档文件 - Diagram export from EA to document file using Open XML SDK 使用Open XML从Word文档中提取Visio图? - Extract Visio diagram from word document using open xml? 使用Open XML从Word文档中提取嵌入式包文件? - Extract embedded package files from word document using open xml?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM