Table Resizing

<< Click to display table of contents >>

Table Resizing

Table Layout Algorithm

Tables do not have column widths and row heights specified explicitly.

Widths are calculated basing on:

minimal width required to display document inside cell (if rvtoIgnoreContentWidth is not in table.Options)

table.BestWidth

cells BestWidth

Heights are calculated basing on:

heights of cells content (if rvtoIgnoreContentHeight is not in table.Options and cell.IgnoreContentHeight = False)

cells BestHeight

Rules for calculations table width:

1.cells always have widths large enough to contain the widest of their item (if rvtoIgnoreContentWidth is not in table.Options);

2.if table.BestWidth<>0,  it defines width of the table (but table can be wider because of the rule 1)

3.if table.BestWidth=0 then

if all columns have cells with BestWidths in TRVStyleUnits, i.e. pixels or twips or EMU (and do not have cells with BestWidths in %), width of table is calculated basing on cells BestWidths and minimal widths required to show cells contents without overlapping (in this case mouse resizing works the most similar to MS Word)

otherwise, width of table is the same as with BestWidth=-100 (100%) (in this version TRichView cannot calculate width of table basing on optimal widths of cells)

Rules for calculating widths of cells are quite complicated.

The most important rules (when widths of cells are conflicting):

widths of cells to the left have higher priority than widths of cells to the right;

widths of cells in % have higher priority than widths in pixels/twips/EMU.

Resizing with Mouse

Resizing with mouse is possible only in editor.

If you include rvtoRowSizing and rvtoColSizing in table.Options, users will not be able to resize it.

When user resizes table with mouse, he/she actually changes values of BestWidth or BestHeight properties of cells.

When resizing columns with mouse, and columns to the left and to the right do not have cells with BestWidths in %, RichViewEdit adjusts BestWidths of cells of column to the right and to the left, trying to keep their total width unchanged.

When resizing with pressed  Shift  key, RichView sets only BestWidths of the column to the left.