D
dimov.vlatko
Hi,
Has anyone used the apache POI APi to construct Word documents?
I have this piece of code wich creates .doc file from data that is
extracted by the WordExtractor class from another .doc file -
Lettet.doc.
String filename = "E:\\Letter.doc";
FileInputStream fis = null;
try {
fis = new FileInputStream(filename);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
HWPFDocument doc = new HWPFDocument(fis);
WordExtractor we = new WordExtractor(doc);
String wordtext = we.getText();
PrintWriter file = new PrintWriter(new BufferedWriter(new
FileWriter("E:\\NewLetter.doc")));
StringBuffer strbuf = new StringBuffer(wordtext);
strbuf.delete(0, 80);
String wordtextOut = strbuf.toString();
System.out.println(wordtextOut);
file.print(wordtextOut);
file.close();
I construct the document NewLetter.doc but the data inside it is raw
text, so which class of the POI API should I use to make some changes
in the NewLetter.doc like making the text inside BOLD or changing the
size.
Thanks
Has anyone used the apache POI APi to construct Word documents?
I have this piece of code wich creates .doc file from data that is
extracted by the WordExtractor class from another .doc file -
Lettet.doc.
String filename = "E:\\Letter.doc";
FileInputStream fis = null;
try {
fis = new FileInputStream(filename);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
HWPFDocument doc = new HWPFDocument(fis);
WordExtractor we = new WordExtractor(doc);
String wordtext = we.getText();
PrintWriter file = new PrintWriter(new BufferedWriter(new
FileWriter("E:\\NewLetter.doc")));
StringBuffer strbuf = new StringBuffer(wordtext);
strbuf.delete(0, 80);
String wordtextOut = strbuf.toString();
System.out.println(wordtextOut);
file.print(wordtextOut);
file.close();
I construct the document NewLetter.doc but the data inside it is raw
text, so which class of the POI API should I use to make some changes
in the NewLetter.doc like making the text inside BOLD or changing the
size.
Thanks