Is there a w开发者_Go百科ay to export a flex graph to excel? Thank you in advance!
While I've never tried doing this myself, it looks like some other folks have solutions for exporting to Excel.
Check out:
http://coenraets.org/blog/2009/11/open-in-excel-another-air-2-mini-sample/
http://code.google.com/p/as3xls/
The following might help if you are using a Flex app served from a Web app with a Java backend.
Flex includes some nifty out-of-the-box functionality for capturing images. If it suits your requirements to simply take a snapshot of the graph and slap it into an Excel document, it should be possible.
Here's an example for grabbing a snapshot. The bytes could conceivably be streamed back to the Web app. Then you could reconvert the bytes into an image object and use POI to add the image to Excel.
Another option might be to take the same underlying dataset used for rendering the chart in Flex and just build the chart in Excel. That assumes that the chart does not need to have the same look and feel as the corresponding Flex version, though. I've never used it, but the jXLS tool looks like it might provide Excel chart-building capabilities.
精彩评论