Vote count:
0
Im coming directly from XSSF to XWPF, and i can't find any indepth guides for this tool.
Im trying to edit this docx document, the concept of the document is that it's read-only, except for a few fields with foreground gray. These fields are made for the employees to edit the document w/o actually messing up the document structure. So my question is if i have any way to detect these kinds of fields and edit them instead of writing next to them as i do now?
my current XWPF code snippet - that just writes regularly to the document w/o touching the fields as i would like:
XWPFDocument doc = new XWPFDocument(input);
for (XWPFParagraph p : doc.getParagraphs())
{
for (XWPFRun r : p.getRuns())
{
if(r.getText(0) != null)
{
String text = r.getText(0);
if (text.contains("Kundenummer"))
{
text = text.replace("Kundenummer", "Kundenummer:" +
customer.getKundeNummer());
r.setText(text);
}
text = r.getText(0);
if(text.contains("din konto nr."))
{
text = text.replace("din konto nr.", "dit konto nr.
" + customer.getKundeNummer());
r.setText(text);
}
}
}
any help would be greatly apreciated :)
asked 45 secs ago
Aucun commentaire:
Enregistrer un commentaire