Hi,
I am using Aspose API to get the font size of paragraph break character used in paragraph table in primary header and found that API is not giving correct result. From Microsoft Word UI, I can see font size of Header as 10 while ASPOSE API is returning me font size 12. Kindly find the sample code below and look into the issue. Please let me know if you need more information.
Sample test Code:
--------------------------------
public void test() throws Exception {
Document doc = new Document("Sample Document1.docx");
Section sec0 = doc.getSections().get(0);
Section lastSec = null;
if (doc.getSections().getCount() > 1)
lastSec = doc.getSections().get(doc.getSections().getCount() - 1);
HeaderFooter hf = sec0.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.HEADER_PRIMARY);
System.out.println(hf.isHeader());
System.out.println(hf.getText());
NodeCollection hfChildren = hf.getChildNodes();
for (int i = 0; i < hfChildren.getCount(); i++) {
Node child = hfChildren.get(i);
if (child.getNodeType() == NodeType.PARAGRAPH) {
Paragraph para = (Paragraph)child;
com.aspose.words.Font font = para.getParagraphBreakFont();
System.out.println("Font Size: " + font.getSize());
System.out.println("Font name: " + font.getName());
System.out.println("Font bold: " + font.getBold());
System.out.println("Font Style Name: " + font.getStyle().getName());
System.out.println("Font Base Style Name: " + font.getStyle().getBaseStyleName());
}
}
}
------------------------------------------
Output:
Font Size: 12.0
Font name: Times New Roman
Font bold: false
Font Style Name: Default Paragraph Font
Font Base Style Name:
Please find the sample document and snapshot in the attachment.
Please help me resolving this problem.
Thanks
Manisha