NativeExcel2 for .Net Developer's Reference

IWorkbook.SaveAsMethod(Stream, XlFileFormat, ExportOptions)

Saves the workbook to the specified output stream.

[Visual Basic]
FunctionSaveAs(_
ByValoutputStreamAsStream,_
ByValFileFormatAsXlFileFormat,_
ByValoptionsAsExportOptions_
)AsBoolean
[C#]
boolSaveAs(
StreamoutputStream,
XlFileFormatFileFormat,
ExportOptionsoptions
);
[C++]
boolSaveAs(
Stream*outputStream,
XlFileFormatFileFormat,
ExportOptions*options
);
[JScript]
functionSaveAs(
StreamoutputStream,
XlFileFormatFileFormat,
ExportOptionsoptions
):bool;

Parameters

outputStream
The output stream.
FileFormat
XlFileFormat enumeration. A value that indicates format of the workbook to be saved.
options
ExportOptions. An object which contains export options.

Return Value

Returns true if it succeeded, false otherwise.

Example

This example demonstrates how to use ExportOptions parameter.

[C#]
//Create workbook
IWorkbook book = NativeExcel.Factory.CreateWorkbook();
IWorksheet sheet = book.Worksheets.Add();
sheet.Cells["B2"].Value = "Hello World!!!";

ExportOptionsHtml options = new ExportOptionsHtml();
options.ShowGridLines = true;
options.ShowColumnHeadings = true;
options.ShowRowHeadings = true;

//Stream workbook  
workbook.SaveAs(OutputStream, XlFileFormat.xlHtml, options);

See Also

IWorkbook Interface | NativeExcel Namespace | IWorkbook.SaveAs Overload List | Factory Class | ExportOptionsHtml Class