Documentazione HotXLS

Metodo Open

Apre una cartella di lavoro esistente

Sintassi

function Open(FileName: WideString):Integer;
function Open(Stream: TStream):Integer;
function Open(FileName: WideString; Password: WideString):Integer;
function Open(Stream: TStream; Password: WideString):Integer;
FileName Operandi di convalida. Formula2 viene usata solo per gli operatori between / notBetween
Stream TStream. stream oggetto che può be usato read cartella di lavoro
Password WideString. Stringa che contiene password required open protected cartella di lavoro

Esempio

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

Workbook.Open('book.xls');
This example opens password protected excel Workbook book2.xls with the 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;