Workbook-level border palette for the XLSX facade. Each border combines
five edges (left, right, top, bottom, diagonal); each edge carries a
TXLSXBorderStyle token and an optional ARGB
color. The collection lives on
TXLSXWorkbook.Borders;
cells pick a border through
TXLSXCell.BorderIndex
(1-based). Declared in
lxHandleX.
TXLSXBorderStyle declaration
type
TXLSXBorderStyle = (
xlsxBorderNone,
xlsxBorderThin,
xlsxBorderMedium,
xlsxBorderThick,
xlsxBorderDouble,
xlsxBorderDotted,
xlsxBorderDashed,
xlsxBorderHair,
xlsxBorderMediumDashed,
xlsxBorderDashDot,
xlsxBorderMediumDashDot,
xlsxBorderDashDotDot,
xlsxBorderMediumDashDotDot,
xlsxBorderSlantDashDot);
TXLSXBorderEdge declaration
type
TXLSXBorderEdge = class
constructor Create;
procedure Assign(Source: TXLSXBorderEdge);
property Style: TXLSXBorderStyle;
property Color: LongWord;
property ColorIsAuto: Boolean;
property ColorTheme: Integer;
property ColorIndex: Integer;
property TintAndShade: Double;
end;
Single border edge. Style = xlsxBorderNone suppresses the
line. ColorIsAuto = True omits the
<color/> child so Excel picks the theme color.
ColorTheme / ColorIndex / TintAndShade
follow the same priority as TXLSXFont:
theme (≥0) > indexed (≥0) > RGB (Color).
TXLSXBorder declaration
type
TXLSXBorder = class
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TXLSXBorder);
procedure SetAll(AStyle: TXLSXBorderStyle); overload;
procedure SetAll(AStyle: TXLSXBorderStyle; AColor: LongWord); overload;
property Left: TXLSXBorderEdge;
property Right: TXLSXBorderEdge;
property Top: TXLSXBorderEdge;
property Bottom: TXLSXBorderEdge;
property Diagonal: TXLSXBorderEdge;
property DiagonalUp: Boolean;
property DiagonalDown: Boolean;
end;
TXLSXBorder members
| Left / Right / Top / Bottom / Diagonal |
The five edges. Access
.Style / .Color / .ColorIsAuto
(and optionally .ColorTheme / .ColorIndex /
.TintAndShade) on each edge to customize. |
| DiagonalUp |
When True, draws the diagonal line
from the lower-left to the upper-right corner of the cell. Uses the
Diagonal edge style and color. Emits
diagonalUp="1" on <border>. |
| DiagonalDown |
When True, draws the diagonal line
from the upper-left to the lower-right corner. Emits
diagonalDown="1" on <border>. |
| SetAll(Style) |
Sets Left, Right, Top, and Bottom to the same
style (Diagonal stays untouched). |
| SetAll(Style, Color) |
Same as above but also sets Color on each edge
and clears ColorIsAuto. |
| Assign(Source) |
Copies every edge from Source. |
TXLSXBorders declaration
type
TXLSXBorders = class
function Add: TXLSXBorder; overload;
function Add(Source: TXLSXBorder): Integer; overload;
function AddBox(AStyle: TXLSXBorderStyle): Integer; overload;
function AddBox(AStyle: TXLSXBorderStyle; AColor: LongWord): Integer; overload;
procedure Clear;
property Count: Integer;
property Items[Index: Integer]: TXLSXBorder; default;
end;
TXLSXBorders members
| Add |
Appends an empty border (all edges
xlsxBorderNone) and returns the new instance. |
| Add(Source) |
Copies Source into a new entry and
returns its index. |
| AddBox(Style[, Color]) |
Convenience shortcut: appends a border with all
four sides set to Style (and optionally
Color) and returns its index. |
Example
var
thinBox: Integer;
begin
thinBox := Workbook.Borders.AddBox(xlsxBorderThin);
Worksheet.Cells.Item[2, 2].Value := 'Boxed';
Worksheet.Cells.Item[2, 2].BorderIndex := thinBox + 1;
end;
See also