LabWindows/CVI

ExcelRpt_WriteData

HRESULT ExcelRpt_WriteData (CAObjHandle worksheetHandle, char cellRange[], enum ExREnum_ExDataType dataType, size_t dimension1, size_t dimension2, void *data);

Purpose

Writes the specified data to the cell range.

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".
dataType enum ExREnum_ExDataType The data type of the array passed in the data parameter. The data type must be one of the following values:

ExRConst_dataDouble = CAVT_DOUBLE
ExRConst_dataString = CAVT_CSTRING
ExRConst_dataCurrency = CAVT_CY
ExRConst_dataDate = CAVT_DATE
dimension1 size_t Dimension one of the data array.

In order to fill a cell range that is 3 rows by 5 columns you should declare a 2D array as follows:

double dataArray[3][5];

and pass 3 as the value for this parameter.

It is possible to use a 1D array to fill a cell range that consists of a single row or column. In order to fill a cell range that is a single row of 10 columns you can declare a 1D array as follows:

double dataArray[10];

and pass 1 as the value for this parameter, and pass 10 as the value for the Dimension2 parameter .
dimension2 size_t Dimension two of the data array.

In order to fill a cell range that is 3 rows by 5 columns you should declare a 2D array as follows:

double dataArray[3][5];

and pass 5 as the value for this parameter.

It is possible to use a 1D array to fill a cell range that consists of a single row or column. In order to fill a cell range that is a single column of 10 rows you can declare a 1D array as follows:

double dataArray[10];

and pass 1 as the value for this parameter, and pass 10 as the value for the Dimension1 parameter.
data void * The data array.

In order to fill a cell range that is 3 rows by 5 columns you should declare a 2D array as follows:

double dataArray[3][5];

It is possible to use a 1D array to fill a cell range that consists of a single row or column. In order to fill a cell range that is a single row or column of 10 cells you can declare a 1D array as follows:

double dataArray[10];

The table below specifies the type of array that should be passed based on the selected value of the dataType parameter.

Data TypeArray Type
ExRConst_dataString char *
ExRConst_dataDouble double
ExRConst_dataCurrency CURRENCY
ExRConst_dataDate DATE

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