You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "oceanvijai@gmail.com" <oc...@gmail.com> on 2012/06/01 13:05:54 UTC

create a doc file using POI 3.8

Hi,

I am a newbie to POI. What I found browsing around was that the POI is still
a budding API but still can get the job done.....

My requirement is actually very simple, but I find it hard to get it
done..... like put a sentence in a doc file and justify it to the
right/center.... and page break it.....
For this I tried 

          
<code>

HWPFDocument templateFile = new HWPFDocument(new POIFSFileSystem(new
FileInputStream("D:\\POI\\testPOIin.doc")));
          HWPFDocument blankFile = new HWPFDocument(new POIFSFileSystem(new
FileInputStream("D:\\POI\\blank.doc")));

Range r = blankFile.getRange();

CharacterRun d = r.insertBefore("Hi how r u");
d.setColor(5);
Paragraph p = d.getParagraph(0);
p.setJustification((byte)2);

OutputStream out = new FileOutputStream("D:\\POI\\testPOIout.doc");
blankFile.write(out);
out.close();
out.flush();

<code>


But I am not able to get the justification.

Pls advice me if I am headed wrong.


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/create-a-doc-file-using-POI-3-8-tp5710018.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org