Hello,
I am working with CDATA from an XML document which can contain html tags, such as <b>. I am trying to get the text width of the text but it is including the <b> and </b> tags in the calculation. Aside from parsing these out, is there any way to get the text width without doing this?
Example from XML file:
<toci>
<content><![CDATA[<b>A Guide to Using Your Pharmacy Benefits</b>]]></content>
<pageNumber><![CDATA[<b>4</b>]]></pageNumber>
</toci>
This would create the following in the PDF document:
A Guide to Using your Pharmacy Benefits....................4
I have a function that will create the formatted text area for the beginning text andthe periods, then add a formatted text area for the page number. What it is producing is the following:
A Guide to Using your Pharmacy Benefits............... 4
It is calculating the text width of the 4 using <b>4</b> instead of just 4.
Your help is greatly appreciated!
Matt L.
GetTextWidth and CDATA
Re: GetTextWidth and CDATA
Support · Feb 26, 2013Hello Matt,
The GetTextWidth method will return the exact width of the entire string, it cannot parse out the string formatting tags. You would need to parse out the <b></b> tags before passing the string to the GetTextWidth method.
Thanks,
ceTe Software Support Team.
Re: GetTextWidth and CDATA
Support · Feb 28, 2013Hello,
Just to clarify our previous post, the reason the GetTextWidth method cannot parse out the string formatting tags to calculate the width is because the GetTextWidth method is a part of the Font class. Font class is a general class used to set fonts for different page elements in the API.
Thanks,
ceTe Software Support Team.
Re: GetTextWidth and CDATA
Forum member · Feb 28, 2013Thank you for the quick responses. I have implemented a parsing method that is working as expected. I appreciate your time!