BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TChart to clipboard

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Analian
Guest





PostPosted: Tue Mar 29, 2005 7:06 pm    Post subject: TChart to clipboard Reply with quote



I've got a TChart object which I want to copy to the clipboard so I could be
able to paste it in office applications.
The straightforward
Clipboard()->Assign(Chart1);
simply ends with a "Cannot assign a TChart to TClipboard" exception. What
can I do? Thank you.


Back to top
François Charton
Guest





PostPosted: Tue Mar 29, 2005 11:09 pm    Post subject: Re: TChart to clipboard Reply with quote




"Analian" <analian (AT) mail (DOT) bg> a écrit dans le message de news:
[email]4249a758 (AT) newsgroups (DOT) borland.com[/email]...
Quote:
I've got a TChart object which I want to copy to the clipboard so I could
be
able to paste it in office applications.
The straightforward
Clipboard()->Assign(Chart1);
simply ends with a "Cannot assign a TChart to TClipboard" exception. What
can I do? Thank you.


TClipboard "knows" only a few formats : mostly text and images. As such, it
cannot hold a TChart. This is the reason for your exception.

However, TChart objects can be exported to the clipboard either as bitmaps
(BMP) or metafiles (WMF or EMF).

Use the functions
Chart->CopyToClipboardBitmap() or
Chart->CopyToClipboardMetafile(bool enhanced)
(if enhanced=true, you export it as an EMF, if false, as a WMF)

This will allow you to export it as images, which can be more or less
resized in Office applications.

If you want to export the chart as an Excel or Word graph, then pasting in
the clipboard will not work. You need to do it all using Ole calls, (or the
TExcel components). This is not very difficult, but a bit tedious. However,
it allows one to transfer a chart as an excel (or word, or powerpoint)
chart, which the user will be able to modify)

Hope this helps
Francois



Back to top
Analian
Guest





PostPosted: Thu Mar 31, 2005 8:24 am    Post subject: Re: TChart to clipboard Reply with quote



I was curios about exporting to Office applications but it doesn't matter
any more. BMP and EMF's fine. Thank you for helping.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.