For a Paragraph object, how can I determine on which page this is located using the Open XML SDK 2.0 for Microsoft Office ?
相关问题
- Converting byte array output into Blob corrupts fi
- docx4j - delete wml P element
- Replacing in inner Text in open xml element?
- Text Box in Outlook Email
- android apache poi-ooxml causes build error 'a
相关文章
- System.Runtime.InteropServices.COMException (0x800
- Directly signing an Office Word document using XML
- How to print a docx to a specific printer using Mi
- Deleting columns from a table with merged cells
- how to compare two fields in a document in pipelin
- How to save a Jsoup Document to an HTML file?
- Doc4j - Having issues converting docx to PDF with
- How to disable File button in MS-Word 2013?
Here's an extension method I made for that :
It is not possible to get page numbers for a word document using
OpanXml Sdk
as this is handled by the client (like MS Word).However if the document you are working with is previously opened by a word client and saved back, then the client will add
LastRenderedPageBreak
to identify the page breaks. Refer to my answer here for more info aboutLastRenderedPageBreak
s. This enables you to count for the number ofLastRenderedPageBreak
elements before your paragraph to get the current page count.If this is not the case then the noddy option to work around your requirement is to add footers with page numbers (may be with same colour as your documents to virtually hide it!). Only an option - if you are automating the word document generation using
OpenXML sdk
.@Flowerking : thanks for the information.
Because I need to loop all the paragraphs anyway to search for a certain string, I can use the following code to find the page number: