HotXLS Delphi Excel Read Write Library / Component Developers Guide loslab Inc.

SaveAsRTF method

Saves Workbook in RTF file. Returns 1 if it succeeds.

Remarks

This method is deprecated. Use IXLSWorkbook.SaveAs method.

Syntax

function SaveAsRTF(FileName: WideString): Integer;
function SaveAsRTF(Stream: TStream): Integer;
FileName WideString. A string that indicates the name of the file to be saved. You can include a full path; if you don't, Workbook saves the file in the current folder.
Stream TStream. Saves Workbook to a stream specified in the Stream parameter.

Example

This example opens Workbook book.xls and then saves it in RTF file.

Var
  Book: IXLSWorkbook;
begin
  Book := TXLSWorkbook.Create; 
  if Book.Open('book.xls') = 1 then
     Book.SaveAsRTF('book.rtf');
end;
This example creates a new Workbook with two Worksheets and then saves the Workbook in RTF file.

Var
  Workbook: IXLSWorkbook;
begin
  Workbook := TXLSWorkbook.Create; {create new Workbook}
  Workbook.Worksheets.Add; 
  {....}
  Workbook.Worksheets.Add; 
  {....}
  Workbook.SaveAsRTF('C:\book.rtf');
end;
Copyright©2007-2019 loslab.com