Set table columns best fit

General TRichView support forum. Please post your questions here
Post Reply
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Set table columns best fit

Post by vit »

Hello!


I have a table that has columns much wider that it's necessary. Is there a way to reduce some of columns width (starting from index=3) so that a width on each of them is only enough to include a content w/o extra space?
TableBestFit.png
TableBestFit.png (9.49 KiB) Viewed 19579 times
Thanks!
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Set table columns best fit

Post by Sergey Tkachenko »

BestFit option is not implemented yet, sorry.
I can suggest assigning minimal BestWidth to columns, and include rvpaoNoWrap in Options of paragraph style used in this table.
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Re: Set table columns best fit

Post by vit »

Including rvpaoNoWrap in Options for the table's ParaStyle will put the cell's content in one line, which may make column wider, right? I do not want it for all cells, for example, I don't want it at first three columns. Does it mean that I should set rvpaoNoWrap for the all cells that don't contain multiline content?
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Set table columns best fit

Post by Sergey Tkachenko »

I think for this table it's enough to make no-wrap header cells
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

Re: Set table columns best fit

Post by vit »

Table behaves strangely, columns get very wide.

I prepared a demo project that'll help you to see the table and what I'm trying to do. Could you look at it?
Just be sure that file Table.rvf is placed at the same path as Project1.exe. Run it (you'll see the table in initial state) and push the bSetColumnsWidth button

SRV_VERSION = 'v7.2.1';
RVE v16.3.1
DemoApp1.rar
(58.99 KiB) Downloaded 1179 times
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Set table columns best fit

Post by Sergey Tkachenko »

Hello,

This table has a large table.BestWidth assigned.
You set minimal widths for cells in all columns starting from the 4th.
As a result, the table has the same large width as before, but the first 3 columns occupy maximal possible space, and the rest of columns occupy minimal possible space.

To see what happens, assign after loading RVF (so the table is displayed completely):

Code: Select all

    SRVE.PageProperty.Orientation := poLandscape;
    SRVE.PageProperty.PageFormat := srvfmA3;
Post Reply