OleFormat.SaveAs(String) 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 data of the embedded OLE object to a file.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v25.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| fileName | String | Specifies the file path to save the document. |
Exceptions
| Type | Description |
|---|---|
| InvalidOperationException | Occurs when you call the SaveAs method for a linked OLE object. |
Remarks
The following example shows how to save an embedded OLE object’s data to a file:
using System.Linq;
using DevExpress.XtraRichEdit.API.Native;
// ...
Document document = wordProcessor.Document;
// Obtain an OLE object that stores spreadsheet data.
DevExpress.XtraRichEdit.API.Native.Shape embeddedObject = document.Shapes.FirstOrDefault(
x => x.Type == DevExpress.XtraRichEdit.API.Native.ShapeType.OleObject &&
x.OleFormat.InsertType == OleInsertType.Embedded &&
x.OleFormat.ProgId == OleObjectType.ExcelWorksheet);
if (embeddedObject != null)
{
// Save the OLE object's data as an XLSX document.
embeddedObject.OleFormat.SaveAs("ExcelDocument.xlsx");
}
See Also