You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Zachary Mitchell <za...@internode.on.net> on 2010/05/21 06:16:58 UTC

HWPFDocument Questions.

If I am to go:

?

//*********************************************************************

import ...;

int colorOne = 7;
int ftcfe = 9;

HWPFDocument document = new HWPFDocument();
FontTable fontTable = document.getFontTable();
List fontList = Arrays.asList(fontTable.getFontNames()); //This is how to wrap a primitive array.

ListIterator fonts = fontList.iterator();
while(fonts.hasNext())
{
System.out.println(next.toString()); //A
}
Range range = document.getOverallRange();
CharacterRun runOne = range.getCharacterRun(0); //B
Range rageOne = new Range(0,3000,document);
CharacterRun runTwo = runOne.insertAfter("This is some initial Text");
runTwo.setBold(true);
runTwo.setColor(colorOne); //C
runTwo.setFontSize(16);
runTwo.setFtcFE(ftcfe); //D

//Create a paragraph:

Paragraph paragraphOne = new Paragraph(0,200,document.getRange()); //E

...

document.write(new FileOutputStream(new File("WordFile1.doc")));

//*********************************************************************

?

-A: if done with an initially empty constructor HWPFDocument, will this print

all of the TrueType Font names visible through the JVM from the 

particular OS?

Will the index of a particular font be the int value for use in //D ?



-B: Is this how one creates consecutive new CharacterRuns? Can you create 

your own CharacterRuns within a Range stipulating a start index?

What happens with how CharacterRuns end?



-C: Should be a simple one; where are the names/indicies for color values 

here?



-D: If there are TTF names and indicies at //A, is this the index data 

needed here at //D ? 



-E: Is this how one creates a paragraph using pure Java inside

the Java HWPFDocument?



-F: In Java, the newline character symbol is '\n'. In Microsoft Word,

one may type [shift+Enter] for a new line without starting

a paragraph, and [Enter] to end,start a paragraph.

How may one do the [shift+Enter} equivalent in an HWPFDocument?

Do I just insert a '\n' or "\n" where wanted?

?

?