Forum > FPSpreadsheet
[SOLVED] fekcell and fekabs fail with Excel2000
Hopestation:
Hi.
I have just downloaded SpreadsheetInterface_full_V0.11.zip.
Example 'excel8write' writes values into cells E1 and F1 which cause a fault in excel2000 making it shut down with an error message and when I look at fpspreadsheet.pas the section containing "fekcell" and "fekabs" are commented out.
The date on the file has changed since I ran it, but 'excel8read.lpi' has a date of 08/11/2009, so I assume I have an old version.
Can anyone explain what is wrong?
Thanks
Hopestation:
I have found the SVN executable and I now have the latest versions of all fpspreasheet files installed.
The problem still exists for cell E1, the fekadd value gives "#Value! ".
The value for F1, the fekabs value, gives "0" for the absolute value of cell A1 which contains 1. Clicking on this value causes Excel to fail, as before.
I have tried a read example, which also fails.
The excel8read read example only has a .lpr file, which uses writeline to a consol screen which appears and disappears too quickly to be seen, so I have transferred the code to a form and written to a memo component.
The compiler stops at the line:
memo1.lines.add('Row: ' + CurCell^.Row + ' Col: ' + CurCell^.Col +
' Value: ' +
UTF8ToAnsi(MyWorkSheet.ReadAsUTF8Text(CurCell^.Row, CurCell^.Col)));
with the error cursor at the ^ after the first "CurCell".
The error message says:
Read8.pas(78) Fatal: There were 1 errors compiling module, stopping
If I click on this message another, normally invisible, message appears above it saying:
Error: Incompatible types: Got "Word" expected "AnsiString"
These are the latest versions of the examples. Can anyone explain why they both fail?
Thanks.
Hopestation:
I think it is time to abandon fpsreadsheet.
I have solved the problem with the curcell pointer but not the fekabs problem.
I want to open a spreadsheet add data into cells and save it under a new name.
I cannot see any way of doing this with fpspreadsheet.
If I am wrong, please let me know how I do it.
If I am right, please let me know how I modify spreadsheets using lazarus.
Thanks
felipemdc:
I was travelling, so I didn't notice this thread before.
--- Quote from: Hopestation on September 21, 2011, 05:34:14 pm ---I have found the SVN executable and I now have the latest versions of all fpspreasheet files installed.
--- End quote ---
Yes, you should use fpspreadsheet from svn
--- Quote ---The problem still exists for cell E1, the fekadd value gives "#Value! ".
The value for F1, the fekabs value, gives "0" for the absolute value of cell A1 which contains 1. Clicking on this value causes Excel to fail, as before.
--- End quote ---
You mean the formula? Do you really need formula support?
--- Quote ---I have tried a read example, which also fails.
The excel8read read example only has a .lpr file, which uses writeline to a consol screen which appears and disappears too quickly to be seen,
--- End quote ---
Nothing in your description indicates that it fails. It does not disappear too quickly, that's just how Windows processes console apps. To see the result run it from a batch script (a text file with the name for example excel8read.bat) with these 2 lines:
excel8read.exe
pause
It's basic for Windows developers to know how to create a batch file to see the output of console apps...
And in the case of this FPSpreadsheet example you don't even need to create the batch script. It is already in the repository with this name:
run_excel8read.bat
The same for the write example.
--- Quote --- so I have transferred the code to a form and written to a memo component.
The compiler stops at the line:
memo1.lines.add('Row: ' + CurCell^.Row + ' Col: ' + CurCell^.Col +
' Value: ' +
UTF8ToAnsi(MyWorkSheet.ReadAsUTF8Text(CurCell^.Row, CurCell^.Col)));
with the error cursor at the ^ after the first "CurCell".
The error message says:
Read8.pas(78) Fatal: There were 1 errors compiling module, stopping
If I click on this message another, normally invisible, message appears above it saying:
Error: Incompatible types: Got "Word" expected "AnsiString"
These are the latest versions of the examples. Can anyone explain why they both fail?
--- End quote ---
They don't fail, if you write wrong code the compiler will tell you the error ... you just need to fix the error that the compiler shows. Or use the console app properly with a batch script. An example fix for your code:
memo1.lines.add('Row: ' + IntToStr(CurCell^.Row) + ' Col: ' + IntToStr(CurCell^.Col) +
' Value: ' +
MyWorkSheet.ReadAsUTF8Text(CurCell^.Row, CurCell^.Col));
Hopestation:
Thanks for your reply filipemdc.
I thought batch files died with DOS.
I have already solved the IntToStr problem and, no, I don't want to send formulas to a spreadsheet. Designing a spreadsheet in lazarus seems pointless when Microsoft has an application which already does this, i.e. Excel.
Can you tell me how I add data to an existing spreadsheet, preferably a template, .XLT file.
I have looked at an OLE2 example which didn't work, but that seems to be the way to go.
Thanks.
Navigation
[0] Message Index
[#] Next page