Page 1 of 1

Access Violation in TCellStorage.CalcDimensions

Posted: Mon Feb 26, 2007 4:03 pm
by Guest
Hello,

I am a registered user of XLSReadWriteII and recently upgraded to v3.0. When I did, it broke some existing functionality: after building a new Excel workbook from scratch and creating worksheets, styles, etc., I receive an Access Violation when I call TXLSReadWriteII2.Write(). I just updated to 3.01 and the problem still occurs.

The error occurs specifically within TCellStorage.CalcDimensions(), line 98. P1[j] seems to be inaccessible. The size of FCells is about 100, but FCells[0] is the only one with a value, which is $444.

Again, this functionality worked perfectly until upgrading to v3, and my code has not changed at all. What can the problem be?

Unfortunately, the code is proprietary and is too entwined in the application to ship the code or create a test application. Hopefully we can resolve this without the need to re-create the file. Please let me know what other information you need to determine a solution.

Thank you in advance,
Christopher

Posted: Tue Feb 27, 2007 6:39 am
by larsa
Hello

I think the error is elswhere in your code. The CellStorage unit have been very stable, and I can't remeber when I last heard of an error there. As all data in the modul is dynamically allocated, an upgrade may result in that the error shows up now. If you have an error where memory is overwritten, it can be that in the old version this happend at a harmless plase. When you upgrade, a more important part of memory is damaged.


Lars Arvidsson

Posted: Wed Mar 07, 2007 4:30 pm
by Guest
Hi Lars,

Just getting back into this issue...

I did find the problem and can recreate it. It appears when you delete the default worksheet that is automatically created.

This code will indeed cause that access violation in v3:

with TXLSReadWriteII2.Create(Self) do
try
Sheets.Add.Name := 'test';
Sheets.Delete(0);
FileName := 'c:\temp\test.xls';
Write;
finally
Free;
end;


This worked fine in v2. I tried a couple different variations of this method, such as deleting the second worksheet, and the problem still occurred, making me think it will occur any time a sheet is deleted. Please let me know if I am doing something wrong, but I do not think so.

In my code, I dynamically build all of the worksheets using Sheets.Add(). Then, right before saving, I delete the default worksheet that is automatically created. I can change my code to use the default worksheet as the first worksheet, so my issue is resolved. However, if it occurs when any worksheet is deleted, other users will certainly have this issue.

Thanks Lars. Hope this helps!

Christopher

Posted: Thu Mar 08, 2007 8:47 pm
by larsa
Hello

Yes, you where right. I have found the problem now. The fix will be included in the next update.


Lars Arvidsson

Posted: Wed Apr 18, 2007 1:02 pm
by Guest
larsa wrote:Hello

Yes, you where right. I have found the problem now. The fix will be included in the next update.


Lars Arvidsson
-----
Hello Lars Arvidsson,

I have the same problem with version 3.
Can you already tell when the bugfixed version will be available?

Clemens Lehnert