Please check the two hyperlinks at the end of the attached document. As you can see both of them are just underlined with the font size of 11, but when I run the code below I get that bold is set to true for both of them and their font size is 12. Can you please help me out with this?
Thanks,
Zeljko
Code:
public void test() throws Exception {
Document document = new Document(“formular.doc”);
List runs = getRuns(document);
for(Run run: runs) {
System.out.println(run.getText());
System.out.println("Bold is: " + run.getFont().getBold());
System.out.println("Size is: " + run.getFont().getSize());
}
}
private List getRuns(Document document) throws Exception {
final List runs = new ArrayList();
document.accept(new DocumentVisitor() {
@Override
public int visitRun(Run run) throws Exception {
runs.add(run);
return super.visitRun(run);
}
});
return runs;
}
Thanks for your inquiry. The two HYPERLINKS are contained in last Paragraph of this document. I have convert this .doc to .docx using MS Word 2016 and attached it here for your reference. I have extracted below the target XML portion from document.xml.
Aspose.Words just reads this XML content and reports that some Runs have Bold formatting (see <w:b /> tag above). So, this seems to be the expected behavior. If we can help you with anything else, please feel free to ask.
I looked at the XML portion that you have sent me and I do see the tag on couple of places but non of these tags are connected with the two hyperlinks as you can see below. If Aspose.Words just reads this XML content how come it reports that some Runs have Bold formatting? Also, what about the font size? It is set to 11 but Aspose.Words reports that it is set to 12. Please help.
Thanks for your inquiry. Please visualize DOM structure of .doc with DocumentExplorer project. I have attached screenshot of last paragraph here for your reference where you can see there are 9 Run nodes in it. Please tell which Run node(s) are problematic. You can compare Aspose.Words returned values of those Runs with the values mentioned in XML.
It's Run number 4 (mail@koelner-kleinkunstpreis.de) and Run number 8 (www.koelner-kleinkunstpreis.de). Please check the console output below to see the returned values for these Runs and check the XML colored parts above. There are no tags for these two Runs.
If you run the code that I have sent you this is the console output:
Thanks for the additional information. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-12758. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.