Is it possible to export to a WINDOWS metafile file analogous to the SVG export? This is only needed by me under WINDOWS VCL.
Hi,
Sorry, the only vectorial formats we support are SVG and PDF. You could always "cheat" by exporting as a png, then converting the png into a wmf, but it won't be vectorial. To export to png you can do:
var exportInfo: IImgExportInfo := nil;
var img := TFlexCelImgExport.Create(xls, true);
try
img.ExportNext('r:\test.png', TImageColorDepth.TrueColor, TXlsImgType.Png, exportInfo);
finally
img.Free;
end;
But sadly you can't use TXlsImgType.EMF
as file format, because GDI+ doesn't support saving to emf/wmf. You would have to export as png, then put the png inside a wmf/emf, which you can do with a TMetafile/Canvas. An example would be:
var png := TPicture.Create;
try
png.LoadFromFile('r:\test.png');
var meta := TMetafile.Create;
try
meta.SetSize(png.Width, png.Height);
meta.Enhanced := true; //for emf
var Canvas := TMetafileCanvas.CreateWithComment( meta, 0, 'test', 'this is a test');
try
Canvas.Draw(0, 0, png.Graphic);
finally
Canvas.Free;
end;
meta.SaveToFile('r:\test.wmf');
finally
meta.Free;
end;
finally
png.Free;
end;
But again, note that this will just copy put the png inside the metafile, it won't be a "real" metafile.