Thank you both of you,
It's help me so much :), really !
Now i can handle the process of writing string into Excel and i am trying to read from it and getting stuck !
My Excel database includes a column written the system date , e.g the A column . I am trying to read this column and then display at the interface by Tree !
My code is below :
char terminal[10]; // the last cell used
char value[10]; // the value of cell
char null[2]; // NULL
int total; // number of cells used
int index=2; // initative
value of cell address : "A2"
null[0]='\0';
ExcelRpt_ApplicationNew (VTRUE, &ExcelHandle);
GetProjectDir (fileName);
strcat(fileName, "\\book1.xls");
ExcelRpt_WorkbookOpen (ExcelHandle, fileName, &ExcelWorkbookHandle);
ExcelRpt_GetWorksheetFromName (ExcelWorkbookHandle, "Sheet1", &ExcelWorksheetHandle);
ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString,
null, "A1",
ExRConst_Values, ExRConst_Whole, ExRConst_ByColumns, ExRConst_Next, 0, 0,
terminal);
// printf("%s",terminal); use to check error and it displays : $A$11 _
i used from A1 to A10 storing data _ it seems to be right ?
ExcelRpt_RangeSelect (ExcelWorksheetHandle, "A2:terminal"); // i think the argument
"A2:terminal" is the trouble.
//It doesnt work from here!!!
// It can not select the range
ExcelRpt_GetNumCellsInRange (ExcelWorksheetHandle, "A2:terminal", &total); // counting for the number of cells used in A column
// used for loop
// printf("%d",total); it shows a very huge number ,nearly a million

WHY ????????????
for (index;index<total;index++ )
{
sprintf(string,"A%d",index);
ExcelRpt_GetCellValue (ExcelWorksheetHandle, string, ExRConst_dataString, value);
InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING,0 , VAL_NEXT, value, "", 0,0 );
}
/////////////////////////////////////////////////////////
I tried to check the value and datatype of
terminal but i think it's ok and i used this method to write string to Excel (as suggestion from
ebalci
)
I really dont know why ??? 😞
Thank U for reading
😞