OfficeImage.DiscardCachedData() Method
Closes the current image stream and releases any resources associated with the current stream.
Namespace: DevExpress.Office.Utils
Assembly: DevExpress.Office.v24.1.Core.dll
NuGet Packages: DevExpress.Office.Core, DevExpress.Win.Navigation
Declaration
Remarks
Call the DiscardCachedData method before exporting a custom painted image to a PDF file to preserve your modifications. This method clears the current image stream containing no information about the modified image and creates a new one that is aware of the modifications performed. The example below demonstrates this approach:
Document doc = richEditControl1.Document;
ReadOnlyDocumentImageCollection images = doc.Images.Get(doc.Range);
foreach (var img in images) {
using (Graphics gr = Graphics.FromImage(img.Image.NativeImage)) {
// Perform custom painting...
}
img.Image.DiscardCachedData();
}
richEditControl1.ExportToPdf(pdfStream);
See Also