SharpLeaf Reference > SharpLeaf Methods > IncludeTable Method

SharpLeaf.IncludeTable Method

Flow a table within current frame.

The horizontal spacing around the included table is controlled by ParagraphStyle.HorizontalGap.

Overloads

Example

   tb = new Table();
   tb.AddRows(new string[]{"","Column 1","Column 2","Column 3"});
   tb.AddColumns(new string[]{"Row 1","Row 2","Row 3","Row 4"});
   tb.AddRows(new int[][]{new int[]{101,201,301},new int[]{102,202,302},new int[]{103,
            203,303},new int[]{104,204,304}});
  // Force the fit to frame width
   lf.IncludeTable(tb,BoxFlow.Paragraph,-1,true);

Target Width

Positive values are absolute sizes in points, negative values are proportions of the current frame width. Default is -1 for available frame width.

The table will size relative columns (see negative values in Table.SetColumnWidths) so that the whole table width is no less than the target width.

The table may end up wider than the target width if fixed-sized columns (including auto-fit) take up too much width for relative-sized columns to observe Table.SetColumnMinWidths.

The table may end up narrower or wider than the target width if there are no relative-sized columns (target width doesn’t affect the column width at that point).

A target width of 0 will therefore force all relative-sized columns to take their minimum allowed width.

Fit Width

Flag to force the table to fit the target width – and blocks of columns to fit the block width, possibly scaling the table up or down. Default is false.

Block Width

Positive values are absolute sizes in points, negative values are proportions of the current frame width. Default is -1 for available frame width.

Maximum width at which to chop blocks of columns. Determines the eventual number of blocks of columns.

Blocks will generally be slightly shorter due to the fact that effective column widths do not generally add up to block width exactly.

A typical degenerate case is a 3-column table with column widths of {50,-1,50} with a targetwidth of 200 and a block width of 100: the middle column must be of size 100, and blocks can not be even.

Blocks may be wider if retained columns take up too much space (see Table.SetTitles and Table.SetColumnRetain)

A block width of 0 forbids the splitting of columns into blocks.

Scaling factor

Arbitrary scaling factor to apply on table before computing the widths and heights. Default is 1.

See also ...

Table Tutorials | Splitting Blocks of Columns | SharpLeaf Members


Send comments on this topic
© Dyalog Ltd 2021