Documentazione HotXLS

Open metodo

Opens an existing Workbook

Sintassi

funzione Open(FileName: WideString):Integer;
funzione Open(Stream: TStream):Integer;
funzione Open(FileName: WideString; Password: WideString):Integer;
funzione Open(Stream: TStream; Password: WideString):Integer;
FileName WideString. Una stringa che indica il nome del file da aprire. È possibile includere un percorso completo; in caso contrario, Workbook apre il file nella cartella corrente
Stream TStream. A stream object that can be used to read the Workbook
Password WideString. Una stringa che contiene la password necessaria per aprire una cartella di lavoro protetta

Esempio

This example opens excel file book1.xls from the current folder

Workbook.Open('book.xls');
Questo esempio apre la cartella di lavoro Excel book2.xls protetta da password con la password 'password'

Workbook.Open('book2.xls', 'password');
This example changes the name of the first Worksheet in book1.xls

Var book: IXLSWorkbook;
begin
  book := TXLSWorkbook.Create();
  book.Open('book1.xls');
  book.Sheets[1].Name := 'New name';
  book.SaveAs('book1.xls');
end;
This example loads Workbook from a BLOB field

var
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
    SQLDataSet1Documents.SaveToStream(MS);
    FWorkbook.Open(MS);
  finally
    MS.Free;
  end;
end;