11-01-2009 06:07 AM
I'm developing an application in CVI 8.5.0. and I
need to embed a chart and a spreadsheet in a panel . The data in the
spreadsheet is to be plotted in the chart. The problem that I encounter
is that can't set the spreadsheet to act as a data source for the
chartspace (It is mandatory that I use the Microsoft Office Web
Components 11.0 instrument driver). I tried something like:
errChk( OWC11_ISpreadsheetmsDataSourceObject (excelDoc, NULL, "", &dataSource));
errChk( OWC11_ChChartSpaceSetDataSource (excelChartSpace, NULL, dataSource));
but an "Unknown error!" is being thrown ...
Any clues are welcome!
Thanks,
Andrei
11-02-2009 10:46 AM
Cytech,
What is the error number that you are getting, also which function throws that error? How are you creating excelDoc and excelChartSpace ?
11-03-2009 02:41 AM
Hi Richard,
The error code that I get is: {0x80004005 = "Unspecified error"} and is thrown by OWC11_ChChartSpaceSetDataSource.
Here’s how I obtain the handles to the chartspace and the spreadsheet:
/* Get the chartspace handle */
errChk(
GetObjHandleFromActiveXCtrl (panel7Handle, PANEL_7_CHARTSPACE,
&excelChartSpace));
/* Get the excel document handle */
errChk(
GetObjHandleFromActiveXCtrl (panel7Handle, PANEL_7_DOC, &excelDoc));
where PANEL_7_CHARTSPACE and PANEL_7_DOC are the control ID’s for the two objects.
In the description of the DataSource property (in the Microsoft Office 2003 Web Components Visual Basic Reference) there is and example written in VB of how to bind these two objects. The following line:
Set ChartSpace1.DataSource = Spreadsheet1.Object
comes with the solution, but I can’t find the proper functions in CVI to make this work.
Anyway, if we don’t find a way to bind the objects, I think
I can use temporary variables in which I store the data that is to be plotted
and pass them as literal data (OWC11Const_chDataLiteral) to the chart.
Andrei
11-06-2009 05:26 PM
Cytech,
The error comes from the microsoft library, have you tried checking http://www.msdn.com for any examples or forums on this library?