Page 1 of 1
Rows[liRow].PixelHeight don't work!
Posted: Fri May 25, 2007 6:47 am
by mreinoldki
I'm using version 3.01.02 of XLSReadWriteII 3.0.
The code
lXLSReadWriteII21.Sheets[0].Rows[liRow].PixelHeight := 200;
don't have any effect. It doesn't work!
lXLSReadWriteII21.Sheets[0].Rows[liRow].Height := 400;
works...
Regards,
mrk
Posted: Sun May 27, 2007 4:07 pm
by larsa
Hello
I don't have any problems with PixelHeight.
Lars Arvidsson
Posted: Mon Jun 04, 2007 7:51 am
by mreinoldki
Code: Select all
procedure TForm1.Button2Click(Sender: TObject);
var
lXLSReadWriteII21: TXLSReadWriteII2;
liCol: integer;
liRow: integer;
lsFilename: string;
begin
lsFilename := 'c:\temp\XLSTest.xls';
lXLSReadWriteII21 := TXLSReadWriteII2.Create(self);
try
lXLSReadWriteII21.Filename := lsFilename;
for liRow := 0 to 10 do
begin
lXLSReadWriteII21.Sheets[0].Rows.AddIfNone(liRow);
lXLSReadWriteII21.Sheets[0].Rows[liRow].PixelHeight := 200; // don't work!
// lXLSReadWriteII21.Sheets[0].Rows[liRow].Height := 200; - works
// lXLSReadWriteII21.Sheets[0].Rows.SetRowHeight(liRow, liRow, 200); - works
for liCol := 0 to 10 do
begin
lXLSReadWriteII21.Sheets[0].Columns.AddIfNone(liCol, 1);
lXLSReadWriteII21.Sheets[0].Columns[liCol].PixelWidth := 200; // works
lXLSReadWriteII21.Sheets[0].AsWideString[liCol, liRow] := IntToStr(liCol) + '/' + IntToStr(liRow);
end;
end;
lXLSReadWriteII21.Write;
finally
FreeAndNil(lXLSReadWriteII21);
end;
end;
What is wrong in this code?
PixelHeight don't have any effect!
Please, can you give me an example?
Regards,
mrk
Posted: Thu Jun 21, 2007 12:04 pm
by mreinoldki
What is wrong in this code?
Please, can you give me an example?
Posted: Mon Jun 25, 2007 8:53 am
by mreinoldki
Hello Lars,
I modified your Source from
Code: Select all
procedure TXLSRow.SetPixelHeight(const Value: integer);
var
F: TFont;
begin
F := TFont.Create;
try
FFormats.Fonts[0].CopyToTFont(F);
FHeight := -Round((Value / (F.Height / F.Size)) * 20);
finally
F.Free;
end;
end;
to
Code: Select all
procedure TXLSRow.SetPixelHeight(const Value: integer);
var
F: TFont;
begin
F := TFont.Create;
try
FFormats.Fonts[0].CopyToTFont(F);
FHeight := -Round((Value / (F.Height / F.Size)) * 20);
SetHeight(FHeight); //new!!!
finally
F.Free;
end;
end;
and now it works fine for me.
Please let mit know if you plan to add this code to your next releases.
Regards,
mrk
Posted: Wed Jun 27, 2007 10:00 am
by larsa
Hello
This was fixed in version 3.00.03, so you don't seems to have the latest version installed.
Lars Arvidsson