Problem Exporting Charts as Metafiles...
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Problem Exporting Charts as Metafiles...
Hi,
I'm having problems exporting Charts as Metafiles. See video below:
http://screencast.com/t/uEkKdiSz2M
I've attached the small problematic code. This will not compile on my system. In other code I get an AV when I set the Enhanced property to FALSE.
Thanks,
Steve
P.S. I'm running Delphi XE4 under Windows 8 64 bit.
I'm having problems exporting Charts as Metafiles. See video below:
http://screencast.com/t/uEkKdiSz2M
I've attached the small problematic code. This will not compile on my system. In other code I get an AV when I set the Enhanced property to FALSE.
Thanks,
Steve
P.S. I'm running Delphi XE4 under Windows 8 64 bit.
- Attachments
-
- TChart Metafiles.zip
- (5.49 KiB) Downloaded 757 times
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Re: Problem Exporting Charts as Metafiles...
I've spent some more time trying to find the problem. In doing so I've come up with another error.
In the attached code a chart is created, set to a specific size and copied to the clipboard as a enhanced metafile. Here is the code:
Similar code has worked with previous versions.
The errors are as follows:
- If tmp.Enhanced is set to False there is an AV
- The Enhanced Metafile which is copies to the clipboard does not have the right weight and width
I'd appreciate your comments, and if there is a bug, which I believe there is, also a fix!
Thanks,
Steve
P.S. The code now compiles on my machine. I needed to add a "vcltee." before a unit.
In the attached code a chart is created, set to a specific size and copied to the clipboard as a enhanced metafile. Here is the code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
tmp: TEMFExportFormat;
c: TChart;
begin
c := TChart.Create(nil);
c.Width := 1000; // <=== Height and width of new chart are not respected!
c.Height := 500;
CopyChart(Chart1, c);
c.Refresh;
tmp:= TEMFExportFormat.Create;
try
tmp.Enhanced := True; // <== ERROR if set to false
tmp.Panel := c;
tmp.Width := c.Width;
tmp.Height := c.Height;
Clipboard.Clear;
tmp.CopyToClipboard;
finally
tmp.Free;
c.Free;
end;
end;
The errors are as follows:
- If tmp.Enhanced is set to False there is an AV
- The Enhanced Metafile which is copies to the clipboard does not have the right weight and width
I'd appreciate your comments, and if there is a bug, which I believe there is, also a fix!
Thanks,
Steve
P.S. The code now compiles on my machine. I needed to add a "vcltee." before a unit.
- Attachments
-
- TChart Metafiles 2.zip
- (5.5 KiB) Downloaded 692 times
Re: Problem Exporting Charts as Metafiles...
Hi Steve,
Set the Panel before changing the Enhanced property:Steve Maughan wrote:Hi,
I'm having problems exporting Charts as Metafiles. See video below:
http://screencast.com/t/uEkKdiSz2M
I've attached the small problematic code. This will not compile on my system. In other code I get an AV when I set the Enhanced property to FALSE.
Thanks,
Steve
P.S. I'm running Delphi XE4 under Windows 8 64 bit.
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
tmp: TEMFExportFormat;
begin
tmp:= TEMFExportFormat.Create;
try
tmp.Panel := Chart1;
tmp.Enhanced := False; // <== ERROR!
tmp.SaveToFile('Chart1EMF.' + tmp.FileExtension);
finally
tmp.Free;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem Exporting Charts as Metafiles...
Hi again Steve,
I see you also set the Enhanced property before setting the Panel in this code, but I can't reproduce the problem with it. Note I had comment out the CopyChart call, since I don't know what it exactly does.Steve Maughan wrote:I've spent some more time trying to find the problem. In doing so I've come up with another error.
In the attached code a chart is created, set to a specific size and copied to the clipboard as a enhanced metafile. Here is the code:
Similar code has worked with previous versions.Code: Select all
procedure TForm1.Button1Click(Sender: TObject); var tmp: TEMFExportFormat; c: TChart; begin c := TChart.Create(nil); c.Width := 1000; // <=== Height and width of new chart are not respected! c.Height := 500; CopyChart(Chart1, c); c.Refresh; tmp:= TEMFExportFormat.Create; try tmp.Enhanced := True; // <== ERROR if set to false tmp.Panel := c; tmp.Width := c.Width; tmp.Height := c.Height; Clipboard.Clear; tmp.CopyToClipboard; finally tmp.Free; c.Free; end; end;
The errors are as follows:
- If tmp.Enhanced is set to False there is an AV
- The Enhanced Metafile which is copies to the clipboard does not have the right weight and width
I'd appreciate your comments, and if there is a bug, which I believe there is, also a fix!
Thanks,
Steve
P.S. The code now compiles on my machine. I needed to add a "vcltee." before a unit.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Re: Problem Exporting Charts as Metafiles...
Hi Yeray,
By setting the panel first the AV doesn't occur. Thanks!
The "CopyChart" function simply copies the chart. I think CloneChart does the same. My problem is the size of the image copied to the clipboard. It isn't the size of the chart. In the example given in the code I set the chart size to 1000 x 500. The image which is copied to the clipboard is 641 x 319. This is a bug. In previous versions the image copied was the same as the Chart.
Thanks,
Steve
By setting the panel first the AV doesn't occur. Thanks!
The "CopyChart" function simply copies the chart. I think CloneChart does the same. My problem is the size of the image copied to the clipboard. It isn't the size of the chart. In the example given in the code I set the chart size to 1000 x 500. The image which is copied to the clipboard is 641 x 319. This is a bug. In previous versions the image copied was the same as the Chart.
Thanks,
Steve
Re: Problem Exporting Charts as Metafiles...
Hi Steve,
I see it. I tried the following code and it seems the size you set to the chart isn't respected. I've added it to the wish list to be revised for further releases (TV52016657).Steve Maughan wrote:My problem is the size of the image copied to the clipboard. It isn't the size of the chart. In the example given in the code I set the chart size to 1000 x 500. The image which is copied to the clipboard is 641 x 319. This is a bug. In previous versions the image copied was the same as the Chart.
Code: Select all
uses TeeEmfOptions, ClipBrd;
procedure TForm1.Button1Click(Sender: TObject);
var
tmp: TEMFExportFormat;
begin
Chart1.Width:=1000;
Chart1.Height:=500;
tmp:= TEMFExportFormat.Create;
try
tmp.Panel := Chart1;
tmp.Enhanced := false;
Clipboard.Clear;
tmp.CopyToClipboard;
finally
tmp.Free;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Re: Problem Exporting Charts as Metafiles...
Thanks Yeray,
I think this a breaking change - it certainly is for my application. Previous versions have respected the size. I hope it's an easy fix.
Many thanks,
Steve
I think this a breaking change - it certainly is for my application. Previous versions have respected the size. I hope it's an easy fix.
Many thanks,
Steve
Re: Problem Exporting Charts as Metafiles...
Hi Steve,
I see the same behaviour in v8 and v2012.06. Could you please tell us in what version did you see it working as you expect?
I see the same behaviour in v8 and v2012.06. Could you please tell us in what version did you see it working as you expect?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Re: Problem Exporting Charts as Metafiles...
My application has exported chart of the correct size using XE3 and TChart 2012. I think we used Enhanced Matafile not Metafiles but we definitely exported charts with the perfect dimensions.
Thanks,
Steve
Thanks,
Steve
Re: Problem Exporting Charts as Metafiles...
Hi Steve,
Could you please precise what exact TeeChart version were you using? TeeChart Standard v2012 shipped with the IDE, TeeChart Pro 2012.07.121026 PreRelease binary for XE3, TeeChart Pro 2012.07.121105 binary for XE3, TeeChart Pro SourceCode 2012.07.120914, TeeChart Pro SourceCode 2012.07.121026, TeeChart Pro SourceCode 2012.07.121031 or TeeChart Pro SourceCode 2012.07.121105?Steve Maughan wrote:My application has exported chart of the correct size using XE3 and TChart 2012
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 48
- Joined: Tue Aug 03, 2010 12:00 am
Re: Problem Exporting Charts as Metafiles...
Hi Yeray,
Sorry I missed this reply.
I could have sworn previous versions gave a chart of the exact dimensions. However, I cannot find a version which does this. Apologies for saying it did!
So I can only resort to asking it to be added to future versions. It's the only logical behavior.
Thanks,
Steve
Sorry I missed this reply.
I could have sworn previous versions gave a chart of the exact dimensions. However, I cannot find a version which does this. Apologies for saying it did!
So I can only resort to asking it to be added to future versions. It's the only logical behavior.
Thanks,
Steve
Re: Problem Exporting Charts as Metafiles...
Hi Steve,
No problem, don't worry. It's just that, if it worked as desired in a previous version, we could "attack" the issue from a different angle, looking for the changes between working and not working versions.Steve Maughan wrote: I could have sworn previous versions gave a chart of the exact dimensions. However, I cannot find a version which does this. Apologies for saying it did!
So I can only resort to asking it to be added to future versions. It's the only logical behavior.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |