[flexcoders] Re: Flex charts to powerpoint

2010-08-11 Thread Paul


I don't think you can export the charts directly. In my application, I allow 
users to save the chart image as a jpg file which they can insert into their 
powerpoint documents for creating presentations.

var image:ImageSnapshot = ImageSnapshot.captureImage( mychart, 0, new 
JPEGEncoder() );

var file:FileReference = new FileReference();

file.save(image.data, chart.jpg);

HTH
Paul

--- In flexcoders@yahoogroups.com, Lexter halfbaked11...@... wrote:

 Hello guys !!!
 
 Good day, Is it possible to export flex charts into MS Powerpoint?





[flexcoders] Re: Flex charts to powerpoint

2010-08-11 Thread DustinB
I need to post this on my blog, but the way I did it was with an AIR app, 
though a Flex app could do it too. It wasnt ideal, but worked.

Basically, I took my Flex chart and captured it as a bitmap, then transcoded 
that to base64.

MS PowerPoint 2007 supports the .mht file format which is basically XML.

I saved a PPT template in mht format. In the template, I set up where my chart 
images would go and sized it correctly. In the image name I inserted marker 
text I'd later replace with a token.

Save the file as MHT, and then open it and search for the images you added by 
the keywords you used. You will see the images are in base64. 

Replace the base64 text with a token, like [_token_1_].

Save that file as xml.

Then your Air app can read in that file, replace the tokens with the base64 
version of the chart images you have, and then resave the file to disk with a 
.ppt extension.  When Power Point opens the file, it will show it as a normal 
PPT, and the user can save it again as ppt if they like.

The hardest part is sizing the images properly and it sucks that I had to 
create templates first. With enough time, you can decipher the PPT decks start 
and end of slide and make your Flex app smarter about creating each slide.

hth-
Dustin



--- In flexcoders@yahoogroups.com, Lexter halfbaked11...@... wrote:

 Hello guys !!!
 
 Good day, Is it possible to export flex charts into MS Powerpoint?