lamia Kou
lamia Kou

Reputation: 31

add an invisible paragraph in a word document using Apache POI

I have a word document (.docx) that contains some information, I want to edit this document and add to it some text , I want that the text still invisible when I open the document but I want also to access to it easily from my code.
Do you have please any idea how can I proceed ?

Upvotes: 0

Views: 577

Answers (1)

lamia Kou
lamia Kou

Reputation: 31

I was in fact looking for a solution with ApachePOI to make my text invisible in the generated word document.After some researches, I found this solution:

for (XWPFParagraph paragraph : doc.getParagraphs()){
for(XWPFRun run : paragraph.getRuns()){
CTOnOff onoffnull = CTOnOff.Factory.newInstance();
run.getCTR().getRPr().setVanish(onoffnull);
}
}

this code make all paragraphs of a word document invisible by the user.

Upvotes: 1

Related Questions