<< Click to display table of contents >> Colors and Layout of Tables |
The main color properties of tables (Color, BorderColor, BorderLightColor, CellBorderColor, CellBorderLightColor) are shown on the figure above.
There are some more color properties related to rules (lines between cells), see below.
Table can be transparent, if its Color is set to clNone, or semitransparent.
Cells can be individually colored, with specified opacity. You can specify default colors for groups of rows and columns.
Borders can be hidden, if their widths are set to 0 (see BorderWidth and CellBorderWidth). These are default values.
Cell borders can be 3d, like on this figure, or flat (see BorderStyle and CellBorderStyle).
You can hide some sides of borders of some cells (see cells' VisibleBorders) and set individual color for cell border (cell.BorderColor and cell.BorderLightColor).
When a table with invisible border is inserted in TRichViewEdit, such borders are shown as dotted gray lines (see also table Options).
Tables and cells can have background images.
See properties of table: BackgroundImage, BackgroundStyle.
See properties of cell: BackgroundImage, BackgroundStyle.
The figure above shows properties affecting the table layout:
▪BorderHSpacing, BorderVSpacing,
(The dotted red line around the cell contents is imaginary).
Rules are horizontal and/or vertical lines between cells, and may be also between table borders and outermost cells.
By default rules are invisible.
Rules are defined with properties: HRuleWidth, HRuleColor, HOutermostRule, VRuleWidth, VRuleColor, VOutermostRule.
TRichView tables have HTML-style layout, so making one-pixel width borders is a trick.
Even if you set CellBorderWidth=1, CellHSpacing=CellVSpacing=0, 1-pixel width borders of adjacent cells will be visually combined in 2-pixel width borders.
Recommended solution:
setting CellBorderWidth=1, CellHSpacing=CellVSpacing=-1.
This example assumes RVStyle.Units=rvstuPixels. For rvstuTwips, use 15 instead of 1, and -15 instead of -1.
Other solutions (not recommended):
▪hiding cells border and using rules; disadvantages: rules cannot be saved in HTML and RTF;
▪using VisibleBorders to hide one of adjacent border sides