I have a document (.doc) that I've generated using Apache POI with HWPF and I want to change the font type. I'm guessing that the place to change it would be on the character runs inside each paragraph.
CharacterRun has methods such as .setBold()
.setColor()
and .getFontName()
but there isn't any method to set the font that I've been able to find.
In XWPF there is a .setFontFamily()
but is there a way to do the same thing with HWPF?
Range after = doc.getRange();
int numParagraphs = after.numParagraphs();
for(int i = 0; i < numParagraphs; i++){
Paragraph paragraph = after.getParagraph(i);
int charRuns = paragraph.numCharacterRuns();
for(int j = 0; j < charRuns; j++){
int size = 9;
CharacterRun run = paragraph.getCharacterRun(j);
run.setFontSize(size*2); // In half sizes.
}
}