Page 1 of 1

CopyToClipboardMetafile and Windows / Office versions

Posted: Fri Jul 17, 2015 11:35 am
by 16569987
Hi,

On Windows 7, 32-bit or 64-bit, using TeeChart 2013 for RAD XE2, the TChart.CopyToClipboardMetafile as EMF creates an image about 70 times larger (in bytes) compared to Windows XP, 32-bit, using TeeChart 2012 for Delphi 2007. The image sizes are in this case 2Mb v30kb.

This means that Word documents embedding a lot of such images become massive. Do you know what's changed? EMF format? The TChart method? The Windows clipboard?

Thanks for any advice.

Regards

Toreba

Re: CopyToClipboardMetafile and Windows / Office versions

Posted: Fri Jul 17, 2015 1:37 pm
by yeray
Hello Toreba,

I've run this code with all TeeChart version from v2012.05 to the actual version v2015.15 (and the current sources v2015.16).

Code: Select all

uses Series, TeeConst;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Title.Text.Text:=TeeMsg_Version;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    FillSampleValues;
    ColorEachPoint:=true;
  end;

  //Chart1.CopyToClipboardMetafile(true);
  Chart1.SaveToMetafileEnh('E:\tmp\emfChart_v' + TeeProductName +
         TeeVCLMinorVersion + '.' + TeeVCLBuildVersion +'.emf');
end;
Find here all the emf files generated:
emfChart_from_v2012.05_to_v2015.16.zip
(138.11 KiB) Downloaded 554 times
As you can see, from v2013.09 there was an increment in sizes from about 30Kb to about 75Kb.
Note there's an exception, concretely at v2013.08, with about 370Kb. I'm not sure if this is the version where you observed the difference.

Also note, going back to GDI reduces the size of the emf files generated.

Re: CopyToClipboardMetafile and Windows / Office versions

Posted: Thu Aug 13, 2015 11:34 am
by 16569987
Yeray,

Yes, that's exactly the version I was using, in XE2. I will upgrade to a later version.

Thank you very much for your help.

Regards

Toreba

Re: CopyToClipboardMetafile and Windows / Office versions

Posted: Sat Aug 22, 2015 4:02 pm
by 16569987
Yeray,

I ported to TeeChart Pro 2014.12.140923 32-bit VCL, and this helped to an extent, though the files I was producing were still many times larger than they were with TeeChart 2012 for Delphi 2007. Switching back from GDI+ to GDI was much more effective, producing files of much more comparable size. So when did TChart switch to GDI+?

Thanks for your advice.

Toreba

Re: CopyToClipboardMetafile and Windows / Office versions

Posted: Mon Aug 24, 2015 9:26 am
by yeray
Hi Toreba,
toreba wrote:So when did TChart switch to GDI+?
Yeray wrote:TeeChart 2013.09 moved the default Canvas from GDI to GDIPlus
http://www.teechart.net/support/viewtop ... 483#p66483