Board index » cppbuilder » XLSReadWriteII components in BCB6

XLSReadWriteII components in BCB6


2004-09-19 04:29:12 PM
cppbuilder67
Hi,
Is there anyone who has used the XLSReadWriteII components by Axolot
in BCB?
I'm using BCB6 and when trying to convert the Delphi code to C++ I'm
getting all sorts of compiler errors. The code I'm trying to compile
looks as follows:
void __fastcall TForm1::Button2Click(TObject *Sender)
{
// Set the filename.
XLS->Filename = "Test.xls";
// Insert a string.
XLS->Sheets->Items[0]->WriteString(0,0,-1,"Hello");
XLS->Sheets->Items[0]->AsString[0,1] = "This is it."; //errors
// Insert some numbers.
XLS->Sheets->Items[0]->AsFloat[2,0] = 10;
XLS->Sheets->Items[0]->AsFloat[2,1] = 20;
XLS->Sheets->Items[0]->AsFloat[2,2] = 30;
XLS->Sheets->Items[0]->AsFloat[2,3] = 40;
// Insert a formula which sums the above values.
XLS->Sheets->Items[0]->AsFormula[2,4] = "SUM(C1:C4)";
// Write the file.
XLS->Write();
}
//---------------------------------------------------------------------------
Errors:
E2034: Cannot convert 'Ansistring' to 'int'
E2342: Type mismatch in parameter 'Row'(wanted 'int', got
'Ansistring')
E2193: Too few parameters in call to '_fastcall
TSheet::SetAsString(int,int, const AnsiString)'
Assistance will be highly appreciated
Best Regards
Andre Hayward
 
 

Re:XLSReadWriteII components in BCB6

Andre Hayward < XXXX@XXXXX.COM >wrote:
Quote
Hi,

Is there anyone who has used the XLSReadWriteII components by Axolot
in BCB?

I'm using BCB6 and when trying to convert the Delphi code to C++ I'm
getting all sorts of compiler errors. The code I'm trying to compile
looks as follows:

void __fastcall TForm1::Button2Click(TObject *Sender)
{
// Set the filename.
XLS->Filename = "Test.xls";
// Insert a string.
XLS->Sheets->Items[0]->WriteString(0,0,-1,"Hello");
XLS->Sheets->Items[0]->AsString[0,1] = "This is it."; //errors
// Insert some numbers.
XLS->Sheets->Items[0]->AsFloat[2,0] = 10;
XLS->Sheets->Items[0]->AsFloat[2,1] = 20;
XLS->Sheets->Items[0]->AsFloat[2,2] = 30;
XLS->Sheets->Items[0]->AsFloat[2,3] = 40;
// Insert a formula which sums the above values.
XLS->Sheets->Items[0]->AsFormula[2,4] = "SUM(C1:C4)";
// Write the file.
XLS->Write();

}
//---------------------------------------------------------------------------

Errors:

E2034: Cannot convert 'Ansistring' to 'int'
E2342: Type mismatch in parameter 'Row'(wanted 'int', got
'Ansistring')
E2193: Too few parameters in call to '_fastcall
TSheet::SetAsString(int,int, const AnsiString)'

Assistance will be highly appreciated

Best Regards
Andre Hayward
Carefully read the documentation for XLSReadWriteII and check
what parameters are required for each method you are calling.
The errors you are getting say that you are passing the wrong
type of or number of parameters to those methods. Since it is
a commercial product, I don't have the documentation to be able
to tell you where you went wrong, exactly, but that is the
basic problem. You need to give the methods what they expect
for parameters.
-Terry