excel datein auslesen mit bcb



  • hi
    wie kann ich im borland c++ builder eine excel datei auslesen?
    gibts dafuer irgendwelche komponenten oder ein beispiel?

    thx



  • Siehe FAQ unter "Excel".



  • Hallo,

    Nur mal eine kleine Anmerkung zur Wrapperklasse. In GetCellString und SetCellString sind Col und Row vertauscht.
    So ist es richtig

    String __fastcall TMLWorksheet::GetCellString(int Col, int Row)
    {
       return var_Sheet.OlePropertyGet("Cells",Row+1,Col+1).OlePropertyGet("Value");
    }
    //----------------------------------------------------------------------------
    void __fastcall TMLWorksheet::SetCellString(int Col, int Row, String Text)
    {
       var_Sheet.OlePropertyGet("Cells",Row+1,Col+1).OlePropertySet("Value",Text.c_str());
    }
    //---------------------------------------------------------------------------
    

    Ciao



  • ich hab das jetzt mal ausgetestet nur leider geht das nicht so richtig

    wenn ich das projekt compilen tu bekomm ich in der datei sysvari.h folgende fehler ...

    [C++ Error] sysvari.h(2561): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2561): E2449 Size of 'args' is unknown or zero
    [C++ Error] sysvari.h(2561): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2562): E2094 'operator+' not implemented in type 'TAutoArgs<1>' for arguments of type 'int'
    [C++ Error] sysvari.h(2563): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2563): E2285 Could not find a match for 'Variant::OlePropertySet(const AnsiString,undefined)'
    [C++ Error] sysvari.h(2462): E2450 Undefined structure 'TAutoArgs<2>'
    [C++ Error] sysvari.h(2462): E2449 Size of 'args' is unknown or zero
    [C++ Error] sysvari.h(2462): E2450 Undefined structure 'TAutoArgs<2>'
    [C++ Error] sysvari.h(2463): E2094 'operator+' not implemented in type 'TAutoArgs<2>' for arguments of type 'int'
    [C++ Error] sysvari.h(2463): E2094 'operator+' not implemented in type 'TAutoArgs<2>' for arguments of type 'int'
    [C++ Error] sysvari.h(2464): E2450 Undefined structure 'TAutoArgs<2>'
    [C++ Error] sysvari.h(2464): E2285 Could not find a match for 'Variant::OlePropertyGet(const AnsiString,undefined)'
    [C++ Error] sysvari.h(2454): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2454): E2449 Size of 'args' is unknown or zero
    [C++ Error] sysvari.h(2454): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2455): E2094 'operator+' not implemented in type 'TAutoArgs<1>' for arguments of type 'int'
    [C++ Error] sysvari.h(2456): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2456): E2285 Could not find a match for 'Variant::OlePropertyGet(const AnsiString,undefined)'
    [C++ Warning] MLExcel.cpp(134): W8070 Function should return a value
    [C++ Error] sysvari.h(2454): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2454): E2449 Size of 'args' is unknown or zero
    [C++ Error] sysvari.h(2454): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2455): E2094 'operator+' not implemented in type 'TAutoArgs<1>' for arguments of type 'int'
    [C++ Error] sysvari.h(2456): E2450 Undefined structure 'TAutoArgs<1>'
    [C++ Error] sysvari.h(2456): E2285 Could not find a match for 'Variant::OlePropertyGet(const AnsiString,undefined)'
    [C++ Error] sysvari.h(2456): E2228 Too many error or warning messages

    ich hab in der datei nie was geaendert ...
    mein compiler ist der borland builder 5.0


Anmelden zum Antworten