java - spacing and margin settings in word document using Apache POI docx -
i have 2 paragraphs , want 100 pt space before each line. there way can in apache poi
?
here code snippet
xwpfdocument doc = new xwpfdocument(); xwpfparagraph documenttitle = doc.createparagraph(); documenttitle.setalignment(paragraphalignment.center); xwpfrun run = documenttitle.createrun(); run.settext("paragraph 1"); run.setbold(true); run.setfontfamily("calibri"); run.setfontsize(13); run.setcolor("4f81bd"); run.addbreak(); run.settext("paragraph 2"); run.setbold(true); run.setfontfamily("calibri"); run.setfontsize(13); run.setcolor("4f81bd");
here how add 100 pt
space between 2 paragraphs? there way can achieve this? addbreak()
not keeping space between 2 lines.
and how set margin spacing in docx?
any appreciated.
thanks.
got answer..
documenttitle.setalignment(paragraphalignment.center); // trick documenttitle.setspacingbefore(100);
it lefe me 100pt space between each line of text
if want add custom margins document. use code.
ctsectpr sectpr = document.getdocument().getbody().addnewsectpr(); ctpagemar pagemar = sectpr.addnewpgmar(); pagemar.setleft(biginteger.valueof(720l)); pagemar.settop(biginteger.valueof(1440l)); pagemar.setright(biginteger.valueof(720l)); pagemar.setbottom(biginteger.valueof(1440l));
The last part of the story will not work bro
ReplyDelete