LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind a Chartspace to a Spreadsheet component?

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

0 Kudos
Message 1 of 4
(4,181 Views)

Cytech,

 

What is the error number that you are getting, also which function throws that error? How are you creating excelDoc and excelChartSpace ? 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 4
(4,159 Views)

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 

0 Kudos
Message 3 of 4
(4,147 Views)

Cytech,

 

The error comes from the microsoft library, have you tried checking http://www.msdn.com for any examples or forums on this library?

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 4
(4,112 Views)