officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-dot-savedocument-x28-system-dot-string-devexpress-dot-xtrarichedit-dot-documentformat-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Saves the document to a file, specifying the document’s format.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
void SaveDocument(
string fileName,
DocumentFormat format
)
Sub SaveDocument(
fileName As String,
format As DocumentFormat
)
| Name | Type | Description |
|---|---|---|
| fileName | String |
A string value specifying the path to a file into which to save the control’s document.
| | format | DocumentFormat |
One of the DocumentFormat enumeration values.
|
Note
The SaveDocument method call does not automatically change the Modified property value.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(String, 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.
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/CustomXmlActions.cs#L37
document.CustomXmlParts.Add(xmlDoc);
document.SaveDocument("Result.docx", DocumentFormat.OpenXml);
System.Diagnostics.Process.Start("explorer.exe", "/select," + "Result.docx");
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/CustomXmlParts.cs#L42
document.CustomXmlParts.Add(xmlDoc);
document.SaveDocument("Result.docx", DocumentFormat.OpenXml);
System.Diagnostics.Process.Start("explorer.exe", "/select," + "Result.docx");
winforms-rich-edit-manage-tracked-changes/CS/XtraRichEdit_TrackChanges/Form1.cs#L24
richEditControl1.TrackedMovesConflict += DocumentProcessor_TrackedMovesConflict;
richEditControl1.Document.SaveDocument("DocumentWithRevisions.docx", DocumentFormat.OpenXml);
SpecifyDisplayOptions();
wpf-richedit-manage-tracked-changes/CS/DXRichEdit_TrackChanges/MainWindow.xaml.cs#L21
AcceptAndRejectRevisions();
richEditControl1.Document.SaveDocument("DocumentWithRevisions.docx", DocumentFormat.OpenXml);
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/CustomXmlActions.vb#L34
document.CustomXmlParts.Add(xmlDoc)
document.SaveDocument("Result.docx", DocumentFormat.OpenXml)
System.Diagnostics.Process.Start("explorer.exe", "/select," & "Result.docx")
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/CustomXmlParts.vb#L39
document.CustomXmlParts.Add(xmlDoc)
document.SaveDocument("Result.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
System.Diagnostics.Process.Start("explorer.exe", "/select," & "Result.docx")
winforms-rich-edit-manage-tracked-changes/VB/XtraRichEdit_TrackChanges/Form1.vb#L19
AddHandler richEditControl1.TrackedMovesConflict, AddressOf DocumentProcessor_TrackedMovesConflict
richEditControl1.Document.SaveDocument("DocumentWithRevisions.docx", DocumentFormat.OpenXml)
SpecifyDisplayOptions()
word-document-api-examples/VB/CodeExamples/StylesActions.vb#L113
' Save the resulting document and select it in the File Explorer.
document.SaveDocument("LinkedStyleSample.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
System.Diagnostics.Process.Start("explorer.exe", "/select," & "LinkedStyleSample.docx")
See Also