openxml - How to center text in docx4j -
openxml - How to center text in docx4j -
i have paragraph of text appear in center of document. how can in docx4j? using:
ppr paragraphproperties = factory.createppr(); //creating alignment textalignment align = new textalignment(); align.setval("center"); paragraphproperties.settextalignment(align); //centering paragraph paragraph.setppr(paragraphproperties); but isn't working.
you're there. rather setting textalignment object, utilize jc instance (justification) instead:
ppr paragraphproperties = factory.createppr(); jc justification = factory.createjc(); justification.setval(jcenumeration.center); paragraphproperties.setjc(justification); a simple way of figuring stuff out:
create document (and formatting) you're looking in microsoft word & save file change .docx file suffix 'zip' open zip archive, open 'word' directory , extractdocument.xml file therein examine xml, give clues openxml objects use openxml docx4j
Comments
Post a Comment