Page 1 of 1
XLSReadWriteII 5 in C++ Builder XE3
Posted: Wed Mar 13, 2013 3:35 pm
by mdonath
I have installed the new XLSReadWriteII 5 version.
In C++ Builder XE3 I found the following problems:
- In class 'TXLSTokenizer' there is a function 'EOF'. In C++ it is forbidden to have qualifiers which consists of CAPTITALS only. To compile a project, I have to comment this out.
- When reading Excel 2007 files the method 'TXLSWorksheet.CellType' always returns 'xctNone'.
Markus
Re: XLSReadWriteII 5 in C++ Builder XE3
Posted: Wed Mar 13, 2013 3:51 pm
by larsa
Hello
The EOF method is removed. Was not used anyway. I can't reproduce the CellType problem. Are you sure that there is a value in the cell you read? If it's empty, CellType will return xctNone.
Re: XLSReadWriteII 5 in C++ Builder XE3
Posted: Thu Mar 14, 2013 8:56 am
by mdonath
Hello,
I have downloaded last version (5.10.05), but EOF ist still present.
Here my test code:
Code: Select all
Xls->Filename = L"test001.xlsx";
Xls->DirectRead = true;
Xls->Read();
try
{
for(int s=0; s<Xls->Count(); s++)
{
TXLSWorksheet* Sheet = Xls->Sheets[s];
unsigned LastRow = Sheet->LastRow();
unsigned LastCol = Sheet->LastCol();
unsigned FirstRow = Sheet->FirstRow();
unsigned FirstCol = Sheet->FirstCol();
for(unsigned r=FirstRow; r<=LastRow; r++)
{
for(unsigned c=FirstCol; c<=LastCol; c++)
{
TXLSCellType cT = Sheet->CellType[c][r];
switch(cT)
{
case Xc12utils5::TXLSCellType::xctNone:
Grid->Cells[c+1][r+1] = ColRowToRefStr(c, r);
break;
case Xc12utils5::TXLSCellType::xctBlank:
break;
case Xc12utils5::TXLSCellType::xctBoolean:
case Xc12utils5::TXLSCellType::xctBooleanFormula:
Grid->Cells[c+1][r+1] = Sheet->AsBoolean[c][r] ? L"TRUE" : L"FALSE";
case Xc12utils5::TXLSCellType::xctString:
case Xc12utils5::TXLSCellType::xctStringFormula:
Grid->Cells[c+1][r+1] = Sheet->AsString[c][r];
break;
case Xc12utils5::TXLSCellType::xctFloat:
case Xc12utils5::TXLSCellType::xctFloatFormula:
if(Sheet->IsDateTime[c][r])
{
Grid->Cells[c+1][r+1] = Sheet->AsDateTime[c][r];
}
else
{
Grid->Cells[c+1][r+1] = Sheet->AsFloat[c][r];
}
break;
case Xc12utils5::TXLSCellType::xctError:
case Xc12utils5::TXLSCellType::xctErrorFormula:
{
TXc12CellError err = Sheet->AsError[c][r];
Grid->Cells[c+1][r+1] = Xc12CellErrorNames[err];
} break;
}
}
}
}
}
catch(Exception& e)
{
Application->ShowException(&e);
}
cell type is always xctNone. The file is NOT empty. I will send it per email.
Markus
Re: XLSReadWriteII 5 in C++ Builder XE3
Posted: Thu Mar 14, 2013 11:56 am
by larsa
Hello
You have activated DirectRead. When DirectRead is active, cells are sent trough the OnReadCell event. No cells are stored in memory and hence you will always get xctNone for any cell.
EOF will be removed in the next update. I have however compiled the component with all C++ builder versions from D2007 -> XE3 without any error. Have you enabled some settings before you received the error?
Re: XLSReadWriteII 5 in C++ Builder XE3
Posted: Thu Mar 14, 2013 1:58 pm
by mdonath
Okay, 'DirectRead' was the problem.
The EOF-problem is shown here:
https://www.dropbox.com/s/lbk1p98gv8jm1jm/EOF.PNG
Markus