[英]How to open word document at specific paragraph with poi?
Requirement is this ... 要求是这个...
We are reading word document and getting all annotation from that document, and we are sending this document to user, when user open the document that time document should open with some specific page specific paragraph. 我们正在阅读Word文档并从该文档中获取所有注释,并且正在将该文档发送给用户,当用户打开文档时,该时间文档应以特定的页面特定段落打开。 ( That specific page, paragraph location we can give it, I can give the org.apache.poi.hwpf.usermodel.Range object. )
(我们可以给它特定的页面,段落位置,我可以给org.apache.poi.hwpf.usermodel.Range对象。)
Please provide some example code to do this functionality ... 请提供一些示例代码来实现此功能...
Appreciate you help ... 感谢您的帮助...
There is no way this can be achieved using Apache POI. 使用Apache POI不可能做到这一点。
The only way I can think of to have Microsoft Word scroll to a specific range when a document is opened would be to include an AutoOpen
VBA macro that selects the range. 我可以想到的是,在打开文档时使Microsoft Word滚动到特定范围的唯一方法是包括一个选择范围的
AutoOpen
VBA宏。
For example, to make the 9th paragraph be selected you would have to include the following VBA code (it goes without saying that this only works if macros are enabled): 例如,要选择第9段,您必须包含以下VBA代码(不言而喻,只有在启用宏的情况下,这才起作用):
Public Sub AutoOpen()
ActiveDocument.Paragraphs(9).Range.Select
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.