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

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`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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