Page 1 of 1

Column Width result an access violation

Posted: Thu Jan 29, 2009 10:21 pm
by Mig_2000
Hi,

I have an error when i tried to set a column width in my excel file with xlsreadwrite version 4.00.15

I put this code
XLS.Sheet[0].Columns[0].Width := 12;

and i have an access violation in the unit Columns4.pas on the Fwidth := Value; in this procedure

procedure TXLSColumn.SetWidth(Value: integer);
begin
if (Value < 0) or (Value > $FFFF) then
raise Exception.Create('Invalid value');
FWidth := Value;
end;


FWidth is an inacessible value and i don't know why ?

It is a bug or my error ?

thanks

Re: Column Width result an access violation

Posted: Mon Feb 02, 2009 3:51 pm
by larsa
Hello

You must first ensure that there is a column object. Use XLS.Sheets[0].Columns.AddIfNone(Col,Count).

Re: Column Width result an access violation

Posted: Tue Mar 22, 2016 11:38 am
by indigomage
How do I count the number of columns on a Sheet?

I know that I have written some columns and some sheets, but each instance will be different, and I want to auto size all the columns
You have a count of the number of sheets, but how do I get this for Columns

Re: Column Width result an access violation

Posted: Tue Mar 22, 2016 4:00 pm
by larsa
Hello

What has your question to with the postings in this thread? Also, this thread is 6 years old. Please start a new thread.