Friday, September 2, 2011

How to pass real value to excel through the Code

Hi...

I just came across that while generating a report data into excel through code, required to pass the real values in the report.
Here is an example which illustrates how to pass the real value into excel by ussing the "Arrays"....

static void realValinArrays(Args _args)
{
    //Declaration of Array type -- real...
    Array             arr = new Array(Types::Real);
    CommaIO      commaIO;
    str                  fileName;
    container        con;
    int                  i;
    ;
   
    fileName    = WinAPI::getTempPath() + "Example" + ".csv";
    commaIO = new CommaIO(fileName,"w");
   
    arr.value(1,19.23); //Inserting the real value 19.23 in array postion 1
    arr.value(2,20.0);  //Inserting the real value 20.0 in array postion 2
   
    for( i = 1; i <= 2; i++)
    {
        con = [arr.value(i)];
        commaIO.write(con);
    }
   
    WinAPI::shellExecute(fileName);
}

No comments:

Post a Comment