Number of characters in a cell to wrap text

General TRichView support forum. Please post your questions here
Post Reply
incm
Posts: 15
Joined: Mon Feb 07, 2011 8:47 am

Number of characters in a cell to wrap text

Post by incm »

Good afternoon.

It is necessary to solve this question.
I fill in the runtime template that contains a table with a fixed set of rows and columns. So, I have to write a long text in a cell of a specific column with word-by rows. I specify: hyphenation should not be inside the cell, changing its height, and in the following lines.
That is, I need to pre-calculate the number of characters from my text for each table cell. Given the font and font settings. Something like GetTextExtentExPoint of API Win32.

The work is implemented on the basis of your example RvfEditor.

Thank you in advance for your reply.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

May be you can set the paragraph "no wrap" option instead?
incm
Posts: 15
Joined: Mon Feb 07, 2011 8:47 am

Post by incm »

Sergey Tkachenko wrote:May be you can set the paragraph "no wrap" option instead?

Я в runtime заполняю шаблон, содержащий таблицу с фиксированным набором строк и колонок. Так вот, мне надо записать длинный текст в ячейки определенного столбца с переносом слов по строкам. Уточняю: перенос слов должен быть не внутри ячейки, с изменением ее высоты, а в последующие строки.
Т.е. мне надо предварительно вычислить количество символов из моего текста для каждой ячейки таблицы. Учитывая шрифт и его параметры. Что-то наподобие GetTextExtentExPoint из API Win32
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can apply text style to Canvas:

Code: Select all

RVStyle.ApplyStyle(Canvas, StyleNo, rvbdUnspecified, False, True, nil, False, False);
Then you can use text measuring function of this canvas.
However, when printing, TRVPrint formats document in the printer resolution, so results may be different on the screen and on the printer.
Post Reply