Skip to main content

SpreadsheetDocument.Write

Write

Syntax variant: To a file

Syntax

Write(<FileName>, <SpreadsheetFileType>, <Attachments>)

Parameters

<FileName> (required)

Type: String. Name of the file where spreadsheet document is saved.

<SpreadsheetFileType> (optional)

Type: SpreadsheetDocumentFileType. Format in which spreadsheet document will be saved. Default value: MXL.

<Attachments> (optional)

Type: PDFAttachmentCollection. Object containing PDF document attachments. It is used only for writing to PDF and PDF/A-3 formats. If a spreadsheet document is written in the PDF or PDF/A-3 format and the <Attachments> parameter is specified, the attachments are added in the PDF or PDF/A-3 format.

Description of method variant

Writing of a spreadsheet document to a file.

Syntax variant: To a stream

Syntax

Write(<Stream>, <SpreadsheetFileType>, <Attachments>)

Parameters

<Stream> (required)

Type: Stream, MemoryStream, FileStream. Stream for writing a spreadsheet document.

<SpreadsheetFileType> (optional)

Type: SpreadsheetDocumentFileType. Format in which spreadsheet document will be saved. Default value: MXL.

<Attachments> (optional)

Type: PDFAttachmentCollection. Object containing PDF document attachments. If a spreadsheet document is written in the PDF or PDF/A-3 format and the <Attachments> parameter is specified, the attachments are added in the PDF or PDF/A-3 format.

Description of method variant

Write a spreadsheet document to a stream. Writing to a stream supports the following formats: ANSITXT, DOCX, XLSX, MXL, MXL7, ODS, PDF, TXT. Important! This variant is not available in web client mode.

Description

Saves a spreadsheet document to a file.

Availability

Thin client, web-client, mobile client, server, thick client, external connection, mobile application (client), mobile application (server), mobile standalone server.

Note

On server, web-client, and through external connection:

  • saving in XLS95 format is not available;
  • saving a spreadsheet document with pictures in MXL7 format is not available. An attempt to save a spreadsheet document with pictures in MXL7 format will throw an exception.

Saving a Metafile picture to PDF is not available. This method calls the server when executing on the web-client. The mobile supports saving in MXL and PDF only. If a font is not supported by PDF format, they will be replaced by the Arial font on output. If there is no Arial font, the Helvetica font will be userd instead.

Example

// document writing to a file

TabDoc1.Write("C:\My Documents\Table2.mxl");

// document writing to the stream in XLSX format

Stream = FileStreams.OpenForWriting(Filename);
TabDoc2.Write(Stream, TableDocumentFileType.XLSX);
Stream.Close();

See also

SpreadsheetDocument, method WriteAsync SpreadsheetDocument, method BeginWriting

Translation

Русская версия: ТабличныйДокумент.Записать (SpreadsheetDocument.Write)