开发者

When creating DOCX using DocumentFormat OpenXml is it possible to find out where are we currently on a page?

I'm creating docx file by using DocumentFormat OpenXML API, appending texts, tables, images, etc... at some point I'd like to know how much "space" (rows, pixels, whatever) I have before I reach the end of the page.

Is it possible to get this information? The page size, formatting, margins, etc, are all there - everything that's needed to开发者_如何学JAVA calculate this is in the document.

I do understand that the document itself doesn't deal with formatting, how many pages are there etc, but if not from the OpenXML API, is there some other way to find this out? Maybe some dummy formatter that reads this docx and can be used to find out the 'formatting' data - where is currently the last character positioned on a page, etc... is there such a thing?


I'm not aware of such a "dummy formatter". Such a thing would need to replicate Word's page layout model (including line spacing, how it hyphenates words, calculates space for the header/footer etc). That might be relatively straightforward for simple text only documents, but for a full solution, you have tables, columns, images, text boxes etc etc to worry about.

Can you automate Word and ask it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜