Hello,
I'm trying to produce some reports with specific column widths needed. The problem is that whenever I specify a CharWidth the end result is something a bit less than the CharWidth I specified. I've tried setting width instead (256 * charwidth) but that didn't work either.
Is there a way I can specifiy a specific CharWidth?
Regards
Rob H
(Kilclare Software)
Setting a column's charwidth isn't accurate
-
- Posts: 13
- Joined: Tue Feb 13, 2007 8:47 am
- Location: West Sussex England
Column widths
I had this problem and found it better to use PixelWidth, so I wrote the following function:
function xlsPixelWidth(CharWidth: Double): Integer;
begin
// Returns an adjusted width for a work-around in xlsReadWrite
Result := Trunc(7 * CharWidth) + 5;
end;
Then I simply use (for example)
Columns[0].PixelWidth := xlsPixelWidth(6);
Hope that helps
function xlsPixelWidth(CharWidth: Double): Integer;
begin
// Returns an adjusted width for a work-around in xlsReadWrite
Result := Trunc(7 * CharWidth) + 5;
end;
Then I simply use (for example)
Columns[0].PixelWidth := xlsPixelWidth(6);
Hope that helps
Joe Griffin
GerbilSoft Associates Limited
GerbilSoft Associates Limited