My code will run on Linux and Windows.
It's the code I used for doc:
final HWPFDocument doc = new HWPFDocument(in);
int count = 1;
for (int i = 0; i <
doc.getBookmarks().getBookmarksCount() ; i++)
{
System.out.println(" Size:
"+doc.getBookmarks().getBookmarksCount());
final Bookmark bookmark =
doc.getBookmarks().getBookmark(i);
if (bookmark.getName() != null &&
!bookmark.getName().startsWith("_")
)//if (bookmarkName.equals(bookmark.getName()))
{
System.out.println(count + " |
" + bookmark.getName());
count++;
final String pValue = "****";
final Range range = new Range(bookmark.getStart(),
bookmark.getEnd(), doc);
if (range.text().length()>0)
range.replaceText(pValue,false);
else
range.insertAfter(pValue);
}
}
doc.write(out);
It does not work when the bookmark is in a table.
How to insert the run between the strat and end bookmark elements?
I would like to solve the problem of POI if it is possible.
If this is impossible then used to UNO and Open/LibreOffice.
I'll be glad to any suggestions and advice, and code samples
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Replacing-the-value-of-the-bookmarks-tp5710052p5710092.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]