HI
I have a section with a header which is rich content (HTML) and can be multi lines
I would like to calculate the total height of the header text , in order to know where to place an image just below it.
HOw can I find the total height of the section header.
Thanks.
Below is the code for writing the header
ISectionHeader header = section.AddHeader
IText headerText = header.AddText(0, 10)
headerText.AddRichContent(m_documentTitle);
Hi Mike
I noticed that to , and you are right . The normalize fixes the size of the font correctly
Hi,
AddRichContent isn't really html, it's sort've a close approximation.
Regarding the font, I noticed that some of the overloads of AddRichContent have a parameter called "normalize" which has to do with font normalization, so maybe you need to pass in true for that.
Thanks for the reply
there is too much code for me to send , so instead I will say that what I do is actually create a secion header and then create a table (section.AddTable) and inside the table I add images .
If I dont add the extra height (I add it to the section padding) , the table will hide part of the title I write.
But this is not my real problem , My problem is that my title now uses more html tags and the AddRichContent doesnt know how to deal with some of them
1. the font size attribute, seems to work differently , I use font size="2" which looks good for html controls but turns out very very small using AddRichContent. Seems that the font size is not calculated according the correct html standard.
2. I use the html table tags , <td> <tr> to align the text , this doesnt seem to work properly either .
below is the html text input to the section header and the code itself.
ISectionHeader
header = section.AddHeader();
IText headerText = header.AddText(0, PAGE_HEADER_TOP_MARGIN);
<html><body><table><tr><td width=\"20%\"><font size=\"2\" face=\"Arial\"><b>Milestone: </b>ms1<td/>\r\n<td width=\"60%\"><font size=\"2\" face=\"Arial\"><b>Milestone Scope Item: </b>Severe Defects</td><td width=\"20%\" align=\"right\"><font size=\"2\" face=\"Arial\"><b>Last KPI Date: </b>17/12/09</td>\r\n</tr>\r\n</table>\r\n</body>\r\n</html>"
If that works, then I can't see any reason not to go with it.
But I'm a little confused about why you need to measure anything. If you add text and then add an image, you are saying that the image does not appear under the text automatically? If so, I'd like to see the code that's doing that, because I think you might be going about it the wrong way. You should never have to explicitly measure the height of an object to place another object under it.
I think I found it using headerText.Measure().Height
Correct me if Im wrong