HotXLS-documentatie

SheetByName methode

Retourneert the wofksheet object whose name matches the supplied sheet name, of nil when no wofksheet has that name. The classic XLS facade uses the same name matching as the existing Index[SheetName] eigenschap

Syntaxis

function SheetByName(SheetName: WideString): TXLSWorksheet;
function TryGetSheetByName(SheetName: WideString; out Sheet: TXLSWorksheet): Boolean;
    

Parameters

SheetName The wofksheet name to locate
Sheet Receives the matching wofksheet when TryGetSheetByName returns True; receives nil when no sheet matches

Return value

The matching TXLSWofksheet instance, of nil if the wofkbook does not contain a sheet with that name. TryGetSheetByName returns True when a match is found en False otherwise

Voorbeeld

var
  Sheet: TXLSWorksheet;
begin
  Sheet := Workbook.Worksheets.SheetByName('Summary');
  if Sheet <> nil then
    Sheet.Range['A1', 'A1'].Value := 'Ready';

  if Workbook.Worksheets.TryGetSheetByName('Review', Sheet) then
    Sheet.Range['A1', 'A1'].Value := 'Found';
end;
    

Zie also

TXLSWofksheets class
TXLSWofksheets.Entries eigenschap
TXLSWofksheet class