CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    128

    Question getting data from excel sheet

    hi,

    i am newbie.

    my task is to
    1) Get the data from the excel sheet do some calculations and
    2) Again display the data again on a grid.


    can any please give me a simple sample so that i can start.

    thanks in advance.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: getting data from excel sheet

    Can you export the data to a CSV file or some other format that's easier to work with.

    You can use the ODBC CRecordset class to read from a spreadsheet directly if you have to.

  3. #3
    Join Date
    Nov 2009
    Posts
    128

    Question Re: getting data from excel sheet

    i tried the sample from this link

    http://support.microsoft.com/kb/q199691/

    i am working with visualstudio 2008. and using excel 2007.

    i have followed all the steps and i got 230 errors ..which are as follows.


    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1463) : error C2371: 'FontPtr' : redefinition; different basic types
    1> c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(327) : see declaration of 'FontPtr'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1541) : error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for __uuidof
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1541) : error C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for parameter '_Interface'
    1> c:\program files\microsoft sdks\windows\v6.0a\include\wingdi.h(3667) : see declaration of 'Rectangle'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1541) : error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1541) : error C2955: '_com_IIID' : use of class template requires template argument list
    1> c:\program files\microsoft visual studio 9.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1545) : error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int,int,int,int,int)' : invalid operand for __uuidof
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1545) : error C2923: '_com_IIID' : 'Arc' is not a valid template type argument for parameter '_Interface'
    1> c:\program files\microsoft sdks\windows\v6.0a\include\wingdi.h(2914) : see declaration of 'Arc'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1545) : error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1545) : error C2955: '_com_IIID' : use of class template requires template argument list
    1> c:\program files\microsoft visual studio 9.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(1552) : error C2371: 'PicturePtr' : redefinition; different basic types
    1> c:\program files\microsoft visual studio 9.0\vc\include\comdef.h(341) : see declaration of 'PicturePtr'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2034) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2076) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2178) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2197) : error C2146: syntax error : missing ';' before identifier 'GetRGB'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2197) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2197) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2197) : warning C4183: 'GetRGB': missing return type; assumed to be a member function returning 'int'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2199) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2218) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2220) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2239) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2369) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2408) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2491) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2541) : error C2146: syntax error : missing ';' before identifier 'GetTransparencyColor'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2541) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2541) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2541) : warning C4183: 'GetTransparencyColor': missing return type; assumed to be a member function returning 'int'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2543) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2587) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(2589) : error C2061: syntax error : identifier 'MsoRGBType'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3132) : error C2146: syntax error : missing ';' before identifier 'GradientStops'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3132) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3132) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3190) : error C2146: syntax error : missing ';' before identifier 'GetGradientStops'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3190) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3190) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3190) : warning C4183: 'GetGradientStops': missing return type; assumed to be a member function returning 'int'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3384) : error C2504: '_IMsoDispObj' : base class undefined
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3404) : error C2146: syntax error : missing ';' before identifier 'TextRange'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3404) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3404) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3406) : error C2146: syntax error : missing ';' before identifier 'Column'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3406) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3406) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3408) : error C2146: syntax error : missing ';' before identifier 'Ruler'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3408) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3408) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(3453) : error C2146: syntax error : missing ';' before identifier 'GetTextRange'

    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(25970) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(25972) : error C2146: syntax error : missing ';' before identifier 'Glow'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(25972) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(25972) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(25974) : error C2146: syntax error : missing ';' before identifier 'Reflection'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(74974) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(74974) : warning C4183: 'GetMailEnvelope': missing return type; assumed to be a member function returning 'int'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75683) : error C2146: syntax error : missing ';' before identifier 'HTMLProject'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75683) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75683) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75693) : error C2146: syntax error : missing ';' before identifier 'CommandBars'
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75693) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\testing samples\autoproject\autoproject\debug\excel.tlh(75693) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

    .................................

    how do i fix this issue ?
    please help me........

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: getting data from excel sheet

    Using a CRecordset would be much easier.

    http://www.codeguru.com/cpp/data/mfc...icle.php/c1131

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured