Re: Axolot XLSReadWrite



Joe Griffin wrote:

> I'm currently investigating components to read/write Excel sheets.
> (I have a need to run a routine on a server which does not have Excel
> installed.)
>
> Testing with SM Software's "TXLSFile" component has been simple and
> it appears to do all I need. However, I wanted to compare Axolot's
> "XLSReadWrite" and "XLSMini" components.
>
> It appears that XLSMini does not allow the user to set the column
> widths when writing a spreadsheet and I've had no success in setting
> the column widths in XLSReadWrite.
>
> I'm using the following code to set the width and it compiles just
> fine. However, I get an exception at run time. Can anyone tell me
> how to do it?
>
> xlsReadWrite1.Sheets[0].Columns[1].CharWidth := 26;
>
> TIA,
>
> ... Joe
> Member of the UK Borland User Group


Joe,

Are you trying XlsReadWriteII? Or the original XlsReadWrite?

If XlsReadWriteII, then you need to use the ColumnFormats property to
set the width. Per the help file (which isn't all that helpful...)
Width is set in units of 1/256 of a character width. So to set it to 26
characters, approximately, you'd need to do the following:

xlsReadWrite1.Sheets[0].ColumnFormats[1].Width := 26 * 256;

If you're using the original XlsReadWrite, you set the width in a call
to XlsWrite.WriteColumn.

HTH

Phil
.