У меня есть функция, с помощью котрой я вставляю в MSWord таблиц:
function CreateTable(ANumRows, ANumColumns: integer;
var ATableID: integer): boolean; export;
var
sel_: variant;
begin
CreateTable := true;
try
sel_ := Words_Templs.selection;
Words_Templs.ActiveDocument.Tables.Add(Range := sel_.Range, NumRows := ANumRows, NumColumns := ANumColumns);
ATableID := Words_Templs.ActiveDocument.Tables.Count;
except
CreateTable := false;
end;
end;
Таблица в Word вставляется, но с прозрачными границами.
Макрос (в Word) для зарисовки границ (черные линии), выдал:
With Selection.Borders(wdBorderTop)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderLeft)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderBottom)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
With Selection.Borders(wdBorderRight)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
.Color = Options.DefaultBorderColor
End With
Я попробовал в Delphi 10.2, создать такой же код:
sel_.Cells.Borders.Item(1).LineStyle := 1;
sel_.Cells.Borders.Item(1).LineWidth := 2;
sel_.Cells.Borders.Item(1).Color := 0;
sel_.Cells.Borders.Item(2).LineStyle := 1;
sel_.Cells.Borders.Item(2).LineWidth := 2;
sel_.Cells.Borders.Item(2).Color := 0;
sel_.Cells.Borders.Item(3).LineStyle := 1;
sel_.Cells.Borders.Item(3).LineWidth := 2;
sel_.Cells.Borders.Item(3).Color := 0;
sel_.Cells.Borders.Item(4).LineStyle := 1;
sel_.Cells.Borders.Item(4).LineWidth := 2;
sel_.Cells.Borders.Item(4).Color := 0;
но так я делаю видимой только одну ячейку. А мне нужно всю таблицу сделать видимой
Каким образом это можно сделать?