Clear Font Formatting

Hi,

After executing builder.getFont().clearFormatting() i tought that bold whould be set to false.Can you please check this out?

Thanks,
Zeljko

Code:
@Test
public void test3() throws Exception {


Document wordDoc = new Document(“MnoB.docx”);

DocumentBuilder builder = new DocumentBuilder(wordDoc);

Run t1 =(Run) wordDoc.getChild(NodeType.RUN, 1, true);

builder.moveTo(t1);

System.out.println(builder.getFont().getBold());

builder.getFont().clearFormatting();

System.out.println(builder.getFont().getBold());




}

Hi Zeljko,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does.

The second Run node in the document is a line break. The style applied to its parent node (Paragraph) is 'Heading 1' which have bold formatting. If you clear font formatting using DocumentBuilder.Font and insert some text using DocumentBuilder.write method, the new text will contain font formatting of 'Heading 1'. You can check this behavior using MS Word. Please open your document in MS Word and select word 'BOLD' and clear all formatting of selected text. The output will contain bold formatting because of 'Heading 1' style.

Hope this answers your query. Please let us know if you have any more queries.