Back to Devexpress

RichEditControl.SaveDocument(String, DocumentFormat) Method

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-dot-savedocument-x28-system-dot-string-devexpress-dot-xtrarichedit-dot-documentformat-x29.md

latest3.8 KB
Original Source

RichEditControl.SaveDocument(String, DocumentFormat) Method

SECURITY-RELATED CONSIDERATIONS

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 control’s document to a file and specifies the document’s format.

Namespace : DevExpress.Xpf.RichEdit

Assembly : DevExpress.Xpf.RichEdit.v25.2.dll

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public virtual void SaveDocument(
    string fileName,
    DocumentFormat documentFormat
)
vb
Public Overridable Sub SaveDocument(
    fileName As String,
    documentFormat As DocumentFormat
)

Parameters

NameTypeDescription
fileNameString

A string value specifying the path to a file into which to save the control’s document.

| | documentFormat | DocumentFormat |

One of the DocumentFormat enumeration values.

|

Remarks

You can check the Document.RequiredExportCapabilities, to be sure that the chosen export format supports them.

Note

The SaveDocument method call does not automatically change the RichEditControl.Modified property value.

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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-encryption/CS/DXRichEdit_Encryption/MainWindow.xaml.cs#L52

csharp
if (ext == ".docx")
    richEditControl1.SaveDocument(sfDialog.FileName, DocumentFormat.OpenXml);
else

wpf-richedit-document-encryption/VB/DXRichEdit_Encryption/MainWindow.xaml.vb#L54

vb
If Equals(ext, ".docx") Then
    Me.richEditControl1.SaveDocument(sfDialog.FileName, DocumentFormat.OpenXml)
Else

See Also

SaveDocumentAs

LoadDocument

BeforeExport

IUriProvider

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace