ExcelRpt_ReadDataToTableControl
- Updated2023-02-21
- 2 minute(s) read
HRESULT ExcelRpt_ReadDataToTableControl (CAObjHandle worksheetHandle, char cellRange[], Point startingPoint, enum ExREnum_ExInsertMode readMode, int panelHandle, int controlID);
Purpose
Reads data from cell range in Excel to a CVI table control.
Parameters
| Input | ||||||||||||
| Name | Type | Description | ||||||||||
| worksheetHandle | CAObjHandle | A handle to an Excel Worksheet object. | ||||||||||
| cellRange | char [] | A rectangular range of cells. This value should be a string containing the cell range, such as "A1" or "A1:D5". |
||||||||||
| startingPoint | Point | The coordinates of the cell in the table control that will serve as the starting point for the data read from Excel. This value is of type Point. To specify that the starting cell should be at (3,5), create a Point as shown below: Point p; p.x = 3; p.y = 5; |
||||||||||
| readMode | enum ExREnum_ExInsertMode | Specify how to treat the contents of cells in the table control that will be overwritten with new data. You must select one of the following values:
Overwrite Grow: Overwrites the values in the CVI table. If the cell range is larger than the CVI table then rows and columns are added to the CVI table as needed. Overwrite: Overwrites the values in the CVI table. Unlike the Overwrite Grow option, this option will not alter the size of the CVI table. Insert Row: Inserts new rows at the starting point to hold the new values. Existing rows are shifted down. Insert Column: Inserts new columns at the starting point to hold the new values. Existing columns are shifted to the right. Insert Row and Column: Inserts new rows and columns at the starting point to hold the new values. Existing rows and columns are shifted to the right and down, respectively. |
||||||||||
| panelHandle | int | The specifier for a particular panel that is currently in memory. This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function. |
||||||||||
| controlID | int | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl. | ||||||||||
Return Value
| Name | Type | Description |
| status | HRESULT | A value indicating whether an error occurred. Function failure is indicated by a negative error code. Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h. You can use CA_GetAutomationErrorString to get the description of an error code. |
Additional Information
Library: Excel Report
Include file: activex\excel\ExcelReport.h
LabWindows/CVI compatibility: LabWindows/CVI 7.0 and later