officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-savedocument-x28-system-dot-io-dot-stream-devexpress-dot-xtrarichedit-dot-documentformat-x29.md
Saves the document to a stream, specifying the document’s format.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
public virtual void SaveDocument(
Stream stream,
DocumentFormat documentFormat
)
Public Overridable Sub SaveDocument(
stream As Stream,
documentFormat As DocumentFormat
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
The stream to output the document to.
| | documentFormat | DocumentFormat |
One of the DocumentFormat enumeration values.
|
When the specified document format requires that a certain type of content should be saved as external objects, as is the case for HTML format, the proper use of the SaveDocument becomes more complex. Handle the RichEditDocumentServer.BeforeExport event to specify exporter options, such as the IExporterOptions.TargetUri and the HtmlDocumentExporterOptions.
Note
The SaveDocument method call does not automatically change the RichEditDocumentServer.Modified property value.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(Stream, DocumentFormat) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
word-document-api-automatic-document-conversion-on-web-server/CS/Program.cs#L97
server.SaveDocument(fsOut, destFormat);
Console.WriteLine(outFileName + " file is converted.");
wordProcessor.Options.Export.Html.EmbedImages = true;
wordProcessor.SaveDocument(resultStream, DevExpress.XtraRichEdit.DocumentFormat.Html);
resultStream.Seek(0, SeekOrigin.Begin);
word-document-api-examples/CS/CodeExamples/ExportActions.cs#L129
{
wordProcessor.SaveDocument(htmlFileStream, DocumentFormat.Html);
}
word-document-api-use-multiple-data-sources-for-mail-merge/CS/MailMergeSample/Default.aspx.cs#L62
documentServer.SaveDocument(result, documentFormat);
office-file-api-in-web-api-app/CS/BusinessObjects/Helpers.cs#L35
if (encryptionSettings == null)
server.SaveDocument(resultStream, documentFormat);
else
word-document-api-automatic-document-conversion-on-web-server/VB/Program.vb#L86
server.SaveDocument(fsOut, destFormat)
Console.WriteLine(outFileName & " file is converted.")
word-document-api-examples/VB/CodeExamples/ExportActions.vb#L114
Using htmlFileStream As System.IO.FileStream = New System.IO.FileStream(filePath, System.IO.FileMode.Create)
wordProcessor.SaveDocument(htmlFileStream, DevExpress.XtraRichEdit.DocumentFormat.Html)
End Using
word-document-api-use-multiple-data-sources-for-mail-merge/VB/MailMergeSample/Default.aspx.vb#L50
documentServer.Document.AppendDocumentContent(part2, documentFormat)
documentServer.SaveDocument(result, documentFormat)
Return result
SaveDocument(Stream, DocumentFormat)
See Also