HotXLS 문서

Open 메서드

기존 통합 문서를 엽니다

구문

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 WideString. 열 이름을 나타내는 파일명 문자열입니다 전체 경로를 포함할 수 있으며, 포함하지 않으면 Workbook이 현재 폴더에서 파일을 엽니다
Stream 워크북을 읽는 데 사용할 수 있는 TStream 객체입니다
Password WideString. String 포함합니다 암호 required 로 open protected 통합 문서

예제

이 예제는 암호 'password'로 암호 보호된 Excel 통합 문서 book2.xls를 엽니다

Workbook.Open('book.xls');
이 예제는 book1.xls의 첫 번째 워크시트 이름을 변경합니다

Workbook.Open('book2.xls', 'password');
이 예제는 BLOB 필드에서 통합 문서를 로드합니다

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;