12-13-2010 03:40 AM
Hi,
Why cannot read out the string type data from the worksheet? I have one row and 5 columns in a excel sheet, my code is like follows:
func()
{
char cellStr[1][500];
...
Excel_ActiveApp(NULL, 1, LOCALE_NEUTRAL, 0, &excelAppHandle);
Excel_GetProperty(excelAppHandle, NULL, Excel_AppWorkbooks, CAVT_OBJHANDLE, &excelWorkbooksHandle);
Excel_SetProperty (excelAppHandle, NULL, Excel_AppVisible, CAVT_BOOL, VFALSE);
Excel_WorkbooksOpen(excelWorkbooksHandle, NULL, filePath, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, &excelWorkbookHandle);
Excel_GetProperty(excelAppHandle, NULL, Excel_AppSheets, CAVT_OBJHANDLE, &excelSheetsHandle);
Excel_SheetsItem(excelSheetsHandle, NULL, CA_VariantInt(sheetNum), &excelWorksheetHandle); /* sheetNum equals 1, the first worksheet*/
Excel_WorksheetActivate(excelWorksheetHandle, NULL);
ExcelRpt_ReadData(excelWorksheetHandle, "A2:E2", ExRConst_dataString, cellStr[0]);
...
}
After excuating the code, cellStr has a irrecognizable info. please advise how to get the right string value from the excel's cell.
thanks.
David
12-13-2010 05:19 AM
Hi David,
you can find very useful informations into this post from Mert.
As an additional suggestion, please consider that this thread is not intended for normal question/answer.
You should create a new thread for new questions like this one: you gain better visibility (besides the fact that you are forced to pass by a search in the forum, which in this case would have indeed returned the thread I am pointing you to )