03-28-2018 02:56 AM
I should write a program for selecting a excel file through fileselectpopup and read the data present in excel file and convert it to binary file and store it in some location.
I've written program till selecting excel file through file select popup but I'm not able to open excel file and converting it. I read excepreport, excel2000 examples, but I didn't understand it. Please some one help and guide me step by step. Thanks in advance.
-Vinay
Solved! Go to Solution.
04-03-2018 03:38 AM
Anyone??
04-03-2018 03:46 AM
In what does this discussion differs from this other one of yours? And have you already tried to approach part of the question by yourself?
04-03-2018 07:52 AM
Here, Its with Excel file. Txt file operation is almost done. Now I am not able to understand to get data from Excel sheet.
04-03-2018 08:36 AM - edited 04-03-2018 08:40 AM
So if you need help with Excel you can search for examples installed in CVI related to that product: use the example finder (Help >> Find Examples... menu function) searching for "Excel". Among all the examples listed you can find excel2000dem, which shows the basis of reading/writing to spreadsheets, and excelreportdemo which demonstrates the use of excelreport instrument. There you find working examples to study in order to develop your application.
Please note that all these are examples of interaction between CVI and Excel via ActiveX technology. This means that you need Excel to be installed on the PC where your application is to be developed / run, Additionally, some reduced versions of Excel lack the ActiveX interface, so you need to be sure it is present in the version you are using (I remember what was called Excel Starter a few years ago, which was missing such functionality)
04-09-2018 11:16 PM
HI,
now here I am having problem in reading the data one by one.
i want to read data from a single column of some above 200 rows, i have ranging problem in the code so please help with this problem.
the code is,
////////////////////////////////////read data///////////////////////
error = CA_VariantSetCString (&MyCellRangeV, "A2:C241");
error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, &ExcelRangeHandle);
CA_VariantClear(&MyCellRangeV);
if (error<0)
printf("new problem1");
error = Excel_RangeActivate (ExcelRangeHandle, &ErrorInfo, NULL);
if (error<0)
printf("new problem2");
SetStdioWindowVisibility (1);
printf("Get one cell value at a time:\n");
for (i=0;i<ROWS;i++)
{
printf(" ");
j=2;
// Ask for the ith by jth value of the range which returns a dispatch to a new single cell range
error = Excel_RangeGetItem (ExcelRangeHandle, &ErrorInfo, CA_VariantInt (i+1), CA_VariantInt (j+1), &MyVariant);
// Get the DISPATCH pointer
error = CA_VariantGetDispatch (&MyVariant, &MyDispatch);
// Create a new Range Object from DISPATCH pointer
error = CA_CreateObjHandleFromIDispatch (MyDispatch, 0, &ExcelSingleCellRangeHandle);
// Get the value of the Single Cell Range
error = Excel_GetProperty (ExcelSingleCellRangeHandle, &ErrorInfo, Excel_RangeValue2, CAVT_VARIANT, &MyVariant);
error = CA_VariantGetDouble (&MyVariant, &d);
// Free Variant element
CA_VariantClear(&MyVariant);
//Free Range Handle
printf("%f ", d);
printf("\n");
}
printf("\n");
the sample excel file is
04-10-2018 08:24 AM
Helppppp??
04-10-2018 08:39 AM
As you may know, Excel ranges are 1-based. This is quite clear in the excel2000dem source which you took your code from, since it iterates on rows i-from-0-to-something, columns j-from-0-to-something and then gets the cell (CA_VariantInt (i+1), CA_VariantInt (j+1))
Now you have forced j = 2 but you have not changed the code, which results in getting values from the 3rd column, which is empty...
04-13-2018 10:06 PM
thank you so much.