05-06-2009 02:15 AM
Hi,
I have a doubt in generation of graphs in an excel sheet.
I have to generate a graph for parameter vs different filenames i.e, i should be able to display filenames on the x-axis scaling.
I have to get this using excel api's.
Is there any excel api to do this?
If yes, what is the api?
Can any one help me in doing this?
05-06-2009 02:10 PM
There is a library using the Excel ActiveX interface. It is located in \<CVI>\toolslib\activex\excel\excelreport.fp
Just add the excelreport.fp and excelreport.c files to your project and you are ready to go. This library is not a complete API but it includes almost all necessary functions and it is much much easier to use than the full API, excel.fp
Just a reminder: do not forget to discard any application/workbook/worksheet handle with CA_DiscardObjHandle function when you do not need it anymore.
Otherwise, you will have ghost Excel processes remaining in your Task Manager application list, even if you exit the application.
Hope this helps,
05-14-2009 07:19 AM
Thank you Sir for your suggestion.
Now, i am using excelreport.fp file in my .prj
Here, in my project i am using various excel api's such as
ExcelRpt_ChartSetSourceRange
HRESULT ExcelRpt_ChartSetSourceRange (CAObjHandle chartHandle, CAObjHandle worksheetHandle, char sourceRange[]);
ExcelRpt_SetChartAttributeHRESULT ExcelRpt_SetChartAttribute (CAObjHandle chartHandle, int attributeID, . . .);
ExcelRpt_SetChartAxisAttribute
HRESULT ExcelRpt_SetChartAxisAttribute (CAObjHandle chartHandle, enum ExREnum_ExAxisType axisType, enum ExREnum_ExAxisGroup axisGroup, int attributeID, . . .);
But, i am unable to set the filenames as scaling on x-asis.
Can you please suggest me how can i display/set the filenames as scale on x-axis.
Thankyou in advance.
06-09-2009 08:03 PM
It's very tricky to get it to work as you want when controlling Excel.
Took me some time to generate a correct graph by modifying the original example
shipped with LabWindows/CVI.
Please take a look at the attached CVI project and you will find out some clues
for your application. Run the project and click "Copy Table" then "Calculate"
then "Graph". Notice the comments that I made in the code of
"excelreportdemo.c". You need to use the right functions to generate the right
graph. I use CVI 6.0 and the code works fine with Excel 2003.
07-08-2009 11:48 PM
Thankyou Sir.
But I am unable to build this as ExcelReportDemo.h file is not included in the zip file which you have uploaded.
If possible can you upload the above specified file so that this will be helpful for me.
Thankyou again Sir.
07-09-2009 02:27 PM
OK. Here is the revised zip file containing "ExcelReportDemo.h".