Hyperlink- bold and font size

Hi,

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;
    }

Hi Zeljko,

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.

<w:p w:rsidR="000A53DA" w:rsidRDefault="000A53DA" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
	<w:pPr>
		<w:jc w:val="center" />
	</w:pPr>
	<w:r>
		<w:rPr>
			<w:b />
			<w:bCs />
			<w:sz w:val="20" />
			<w:szCs w:val="20" />
		</w:rPr>
		<w:br />
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:t xml:space="preserve">KuLTuS-Köln: Nikolausstr. 135, 50973 Köln, </w:t>
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:br />
		<w:t xml:space="preserve">Tel.: 0221-4530335, FAX: 0221-4530336, </w:t>
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:br />
	</w:r>
	<w:r>
		<w:fldChar w:fldCharType="begin" />
	</w:r>
	<w:r>
		<w:instrText xml:space="preserve"> HYPER</w:instrText>
	</w:r>
	<w:r>
		<w:instrText>L</w:instrText>
	</w:r>
	<w:bookmarkStart w:id="0" w:name="_GoBack" />
	<w:bookmarkEnd w:id="0" />
	<w:r>
		<w:instrText>INK "mailto:mail@koelner-kleinkunstpreis.de"</w:instrText>
	</w:r>
	<w:r>
		<w:fldChar w:fldCharType="separate" />
	</w:r>
	<w:r>
		<w:rPr>
			<w:rStyle w:val="Hyperlink" />
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" />
		</w:rPr>
		<w:t>mail@koelner-kleinkunstpreis.de</w:t>
	</w:r>
	<w:r>
		<w:fldChar w:fldCharType="end" />
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:br />
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:br />
	</w:r>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:color w:val="00000A" />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:t xml:space="preserve">Mehr Infos unter </w:t>
	</w:r>
	<w:hyperlink r:id="rId6" w:history="1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
		<w:r>
			<w:rPr>
				<w:rStyle w:val="Hyperlink" />
				<w:rFonts w:ascii="Arial" w:hAnsi="Arial" />
			</w:rPr>
			<w:t>www.koelner-kleinkunstpreis.de</w:t>
		</w:r>
	</w:hyperlink>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
			<w:b />
			<w:bCs />
			<w:color w:val="00000A" />
			<w:sz w:val="24" />
			<w:szCs w:val="24" />
		</w:rPr>
		<w:t xml:space="preserve"> </w:t>
	</w:r>
</w:p>

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.

Best regards,

Hi,

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,
Zeljko



KuLTuS-Köln: Nikolausstr. 135, 50973 Köln, Tel.: 0221-4530335, FAX: 0221-4530336, HYPERLINK "mailto:mail@koelner-kleinkunstpreis.de"mail@koelner-kleinkunstpreis.deMehr Infos unter www.koelner-kleinkunstpreis.de

Hi Zeljko,


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.

Best regards,

Hi,

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:

KuLTuS-Köln: Nikolausstr. 135, 50973 Köln, Tel.: 0221-4530335, FAX: 0221-4530336,
Bold is: true
Size is: 12.0
HYPERLINK "mailto:mail@koelner-kleinkunstpreis.de"
Bold is: false
Size is: 11.0
mail@koelner-kleinkunstpreis.de
Bold is: true
Size is: 12.0
Bold is: true
Size is: 12.0
Mehr Infos unter
Bold is: true
Size is: 12.0
HYPERLINK "http://www.koelner-kleinkunstpreis.de/"
Bold is: false
Size is: 11.0
www.koelner-kleinkunstpreis.de
Bold is: true
Size is: 12.0
Bold is: true
Size is: 12.0

Hi Zeljko,


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.

Best regards,

The issues you have found earlier (filed as WORDSNET-12758) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.