Documentazione HotXLS

TXLSXTable e TXLSXTables classes

TXLSXTables is the structured-table collection exposed by TXLSXWorksheet.Tables e each TXLSXTable represents one Excel table definition

Declarations

function Add: TXLSXTable; overload;
function Add(const AName, ARange: WideString; AColumns: TStrings): Integer; overload;
function FindByName(const AName: WideString): TXLSXTable;
function DeleteByName(const AName: WideString): Boolean;
property TXLSXTable.Name, DisplayName, Range: WideString;
property TXLSXTable.Columns: TStringList;
property TXLSXTable.StyleName: WideString;
property TXLSXTable.ShowFirstColumn, ShowLastColumn, ShowRowStripes, ShowColumnStripes, TotalsRowShown: Boolean;
function TXLSXTable.FindFirst(ASheet: TXLSXWorksheet; const AColumnName: WideString; const AValue: Variant): Integer;
function TXLSXTable.FindNext(ASheet: TXLSXWorksheet; const AColumnName: WideString; const AValue: Variant; AAfterRow: Integer): Integer;

Table members

Name and DisplayNameInternal identifier e the table name shown to users
RangeWorksheet range in A1 notation
ColumnsOrdered header names used to write table-column metadata
ColumnIdsStable positive OOXML table-column identifiers
ColumnTotalsRowFunctions and ColumnTotalsRowLabelsPer-column totals row configuration
ColumnCalculatedColumnFormulas and ColumnTotalsRowFormulasPer-column structured-table formulas
AutoFilterRange, AutoFilterColumns and SortStateXmlTable filter e sort metadata
FindFirst and FindNextRicerca di righe per valore di colonna su un foglio fornito dal chiamante: FindFirst restituisce la prima riga in base 1 in cui la colonna indicata è uguale al valore (0 se non c'è corrispondenza), FindNext continues the scan after AAfterRow; i confronti tra stringhe ignorano maiuscole e minuscole, i numeri si confrontano per valore, i booleani per stato di verità, e il modello della tabella resta disaccoppiato da qualsiasi foglio

Esempio

var Columns: TStringList;
begin
  Columns := TStringList.Create;
  try
    Columns.Add('Product');
    Columns.Add('Amount');
    Sheet.Tables.Add('SalesTable', 'A1:B25', Columns);
    Sheet.Tables.FindByName('SalesTable').ShowRowStripes := True;
  finally Columns.Free end;
end;

Vedere also