Page 1 of 1

Fit content in table cells (MailMerge)

Posted: Tue Oct 11, 2011 1:20 pm
by infrax
Hi

I'm doing a mailmerge with tables (fixed cell height and width). The problem occurs when the data(text) is too long to fit in a cell. In this case I should decrement font size until all text fits in.

And I'm doing this in XML first, than I load it in RV and print it with TRVReportHelper.

Any idea how to do this?

First I need to detect that the text is too long. But this can be done only after TRVReportHelper.FormatNextPage or ... I fact I don't know how to do it there either so ... help me out.

Thanks

Posted: Tue Oct 11, 2011 3:02 pm
by Sergey Tkachenko
There is no good solution for this problem, because a text size is known only after formatting.
All that I can suggest is loading cell in a separate RVReportHelper, format it, calculate a document width (I can give a code), change font size, calculate a document width again, and so on. Then modify a font size in the main editor.

Posted: Wed Oct 12, 2011 5:26 am
by infrax
Yes, something like that was on my mind also.

Can you give me a sample code (how to calculate width and height of formatted text)?

Or is this done like this:
- load cell data in separate RVReportHelper
- call Init -> set width to cell width (- padding)
- call FormatNextPage
- with GetLastPageHeight I get the formatted text height

Thanks

Posted: Mon Oct 17, 2011 5:38 pm
by Sergey Tkachenko