![]() |
Array in Worksheet Functions STDEV (Excel in C++)
I have been pretty successful in understanding the implementation of drawing charts in and exporting data to excel. Now I am trying to implement Excel Worksheet functions in C++. Here is the working structure of it:
double wf = xl->Application->WorksheetFunction->STDEV(1,2,3,4,5); cout<<wf; However, I have not been successful in passing an array or vector of doubles to STDEV. E.g. If I have an array: arr[5] = {1,2,3,4,5}; How do I implement: double wf2 = xl->Application->WorksheetFunction->STDEV(arr); cout<<wf2; The kind of errors that I am getting currently relates to passing of the data type into STDEV. Is there a way to convert my arr to const _variant_t type? As this is the type which is being accepted as argument to function STDEV. Any leads? |
Re: Array in Worksheet Functions STDEV (Excel in C++)
I don't know anything about excel automation, but I would think that you need to pass a "SAFEARRAY".
Look for help on msdn. Here's one with an example: http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx |
| All times are GMT +5.5. The time now is 18:25. |