10-10-2014 09:01 AM
Hi community,
I have to generate couple thousands xls files which have some data and a chart on the first sheet. Once the files are generated I'd like to sweep thru all of them and save the chart as an image (BMP, GIF, PNG, doesnt matter).
I have no success though. I assume I am quite close, by using the Chart.export method, but actually nothing happens, the file is not created. (worksheet selection is good, and chart index must be one, as 0 or 2 gives me an error message while one is OK.
Any ideas?
thx.
ps: i know how to export an image of a labview-chart, but I want the export to happen from excel..
Solved! Go to Solution.
10-10-2014 09:21 AM
Is the chart an embedded chart or a chart sheet?
10-10-2014 09:22 AM - edited 10-10-2014 09:22 AM
Right now the chart is part of sheet1 (so its next to the data columns), but the ultimate goal is to have in on a chart sheet.
10-10-2014 10:16 AM
10-11-2014 03:39 PM
The problem is that the worksheet ChartObjects method do not return an Excel._Chart object but an Excel.ChartObject object. Change the ActiveX class from Excel._Chart to Excel.ChartObject (the chartObject contain the actual chart) and use a property node to get the reference to the chart. You can then use this reference to export the chart image.
Ben64
10-12-2014 09:48 AM
Works wonderful! Can you tell me how can I do the same if the chart is not embedded into a worksheet, but it is on a separate chart tab in excel?
10-12-2014 10:20 AM
Instead of getting a reference to the workbook worsheets collection you need to get a reference to the workbook charts collection (which is the collection of all the workbook chartsheets) . You select the chart sheet using its index and convert the resulting item to an Excel._Chart object (this is where you use this object). You can then export it.
Ben64
10-12-2014 10:23 AM
Thanks mate! You helped a lot!
10-13-2014 08:10 AM - edited 10-13-2014 08:13 AM
@1984 wrote:
Thanks mate! You helped a lot!
If you are going to be doing any more of this work with ActiveX and Excel in LabVIEW, get yourself familiar with the
Excel Developer Reference http://msdn.microsoft.com/en-us/library/ee861528%28v=office.14%29
10-13-2014 08:32 AM
nyc a écrit :
@1984 wrote:
Thanks mate! You helped a lot!
If you are going to be doing any more of this work with ActiveX and Excel in LabVIEW, get yourself familiar with the
Excel Developer Reference http://msdn.microsoft.com/en-us/library/ee861528%28v=office.14%29
Thanks for sharing this usefull link nyc, I always end up in the MSDN site but never throught the front door.
Ben64