Home > Software engineering >  Docx4j Jc option
Docx4j Jc option

Time:10-31

I am reading text fields from a Docx file using docx4j Text.class, I have few "tags" which I identify and replace with passed values. Now, few tags are special which carries an indicator like " C" or " R" or " L" as the penultimate two letters. On their occurrence I need to justify the values populated on these tags as well, to clarify not the entire sentence or line or paragraph only the value that is passed and which will replace the tag.

I know the "Jc" option with right "val" provided can help me achieve the desired justification. However, it's on PPr(para properties) level, is there a way to achieve the same for a single word inside a para or body of the docx document?

Also, how to access or set the properties for this single field, after traversing through the document and fetching the required text from it?

CodePudding user response:

As you note, the "Jc" option with right "val" is PPr(para properties) level, not rPr/inline level.

You could investigate putting the word in a text box. Or use tables, or possibly columns? As usual, the trick is to play around in Word until you achieve what you want, then replicate that in docx4j. If you can do it in Word, you can do it with docx4j.

  • Related