RichEditControl.LoadDocumentTemplate(Stream) Method
Loads a document template from the stream.
Namespace: DevExpress.Xpf.RichEdit
Assembly: DevExpress.Xpf.RichEdit.v24.2.dll
NuGet Package: DevExpress.Wpf.RichEdit
Declaration
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A Stream object that is the stream used to load a document. |
Returns
Type | Description |
---|---|
Boolean | true, if the document is successfully loaded; otherwise, false. |
Remarks
The document template cannot be automatically overwritten either in code or in the UI. The information about the original file location and its format is dropped. An attempt to save (i.e., overwrite) the original document invokes the Save As dialog that enables the end-user to specify a different file name and format.
The source stream can be non-seekable. In this case, the stream is buffered automatically. After loading the document, the stream remains open.
The format of the document loaded from a stream is detected automatically by the built-in IFormatDetectorService service implementation. If the format detection fails or the passed stream is null, the RichEditControl.InvalidFormatException event fires.
Determine a moment when the document model can be safely modified using the RichEditControl.DocumentLoaded event. Call the LoadDocumentTemplate method in the Form.Loaded event handler to work with the DocumentLoaded event. Handle the DocumentLayout.DocumentFormatted event to check the loaded document’s layout.
Tip
Use LoadDocumentTemplate method overloads which explicit format definition to improve performance.