Hello,
currently I am modifying some VCL-Apps to use the new XLSX-Format.
In the old apps I used TAdvGridExcelIO for the Export and the Event OnCellFormat:
procedure TfrmMain.AdvGridExcelIOCellFormat(Sender: TAdvStringGrid;
const GridCol, GridRow, XlsCol, XlsRow: Integer; const Value: WideString;
var Format: TFlxFormat);
begin
if (GridRow = 0) then Format.Font.Style := [flsBold];
Format.Borders.Left.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Right.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Top.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Bottom.Style := TFlxBorderStyle.fbs_Thin;
Format.Font.ColorIndex := 1;
end;
const GridCol, GridRow, XlsCol, XlsRow: Integer; const Value: WideString;
var Format: TFlxFormat);
begin
if (GridRow = 0) then Format.Font.Style := [flsBold];
Format.Borders.Left.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Right.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Top.Style := TFlxBorderStyle.fbs_Thin;
Format.Borders.Bottom.Style := TFlxBorderStyle.fbs_Thin;
Format.Font.ColorIndex := 1;
end;
We bought FlexCell and I installed the TMS GridFilters.
I cannot find any information in the documentation about exporting the Borders in the OnExportCell-Event of TAdvGridExcelExport:
procedure TfrmMain.AdvGridExcelExportExportCell(Sender: TObject;
var Args: TExportCellEventArgs);
begin // Doesn't work
if (Args.GridRow = 0) then Args.CellFormat.Font.Style := [TFlxFontStyles.Bold];
Args.CellFormat.Borders.Left.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Right.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Top.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Bottom.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Font.Color.Index := 1;
end;
var Args: TExportCellEventArgs);
begin // Doesn't work
if (Args.GridRow = 0) then Args.CellFormat.Font.Style := [TFlxFontStyles.Bold];
Args.CellFormat.Borders.Left.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Right.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Top.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Borders.Bottom.Style := TFlxBorderStyle.Thin;
Args.CellFormat.Font.Color.Index := 1;
end;
The above code doesn't work - left side cannot be assigned to...
Code completion in the IDE doesn't help either.
What is the correct way to export the borders?
Thanks in advance.
Yours sincerely
Matthias