Skip to content

There is an issue with the function report.Export(image, stream). When exporting as a MetaFile, the obtained stream is incorrect. #785

@allen3371

Description

@allen3371

**version :2026.1.0

When exporting to a PNG stream, the following code works correctly, and the data in the stream can be properly converted into a PNG file:

report.Load(reportFullName);
report.RegisterData(dt, "MyDataSource");
report.Prepare();
ImageExport image = new ImageExport();
image.ImageFormat = ImageExportFormat.Png;
image.Resolution = 300;
image.SeparateFiles = true;
var fn = $"report.png";
MemoryStream ms = new MemoryStream();
report.Export(image, ms);
ms.Position = 0;
var i = Image.FromStream(ms);
i.Save(fn, ImageFormat.Png);

However, when exporting as a MetaFile, the following code results in a blank file:

report.Load(reportFullName);
report.RegisterData(dt, "MyDataSource");
report.Prepare();
ImageExport image = new ImageExport();
image.ImageFormat = ImageExportFormat.Metafile;
image.Resolution = 300;
image.SeparateFiles = true;
var fn = $"report.emf";
MemoryStream ms = new MemoryStream();
report.Export(image, ms);
ms.Position = 0;
var i = Image.FromStream(ms);
i.Save(fn, ImageFormat.Emf); // This produces a completely white EMF file here`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions