Hi,
I put 2 headings consecutively with DocumentBuilder. This is the code:
ParagraphFormat paraForm = builder.getParagraphFormat();
paraForm.setStyleIdentifier(StyleIdentifier.HEADING_1);
paraForm.setLeftIndent(indentHeading(StyleIdentifier.HEADING_1));
builder.writeln("FirstOne");
paraForm.clearFormatting();
paraForm.setStyleIdentifier(StyleIdentifier.HEADING_2);
paraForm.setLeftIndent(indentHeading(StyleIdentifier.HEADING_2));
builder.writeln("SecondOne");
paraForm.clearFormatting();
The resulted document has
- If I don’t use clearFormatting(), FirstOne with Heading2 style and the SecondOne with Heading1 style.
- If I use clearFormatting(), FirstOne with normal style and the SecondOne with Heading1 style.
What is wrong with the code?
Expect an answer ASAP…