Issue with inserting a column

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
egold2005
Posts: 6
Joined: Fri Nov 04, 2016 6:22 am

Issue with inserting a column

Post by egold2005 »

Hello,

I've figured it out that i need the following code in order to insert the column at the beginning of a sheet.

However I can not draw a border around the new column for some reason.

Any ideas?

Thanks a lot,
Eugene.

procedure TSkuListImport.MoveStatusColumn;
var vRow: integer;

begin
with FSheet do begin

Columns.AddIfNone(0, 25);
InsertColumns(0, 1);
for vRow := 4 to FRow do begin
//swap last column with the newly inserted
asString[0, vRow] := asString[25, vRow];
//wipe out the last column
asString[25, vRow] := ''
end;
Columns[0].PixelWidth := 187;

//move the heading
vRow := 0;
asString[0, vRow] := asString[1, vRow];
asString[1, vRow] := '';
with Range[0, vRow, 0, vRow] do begin
FontSize := 16;
FontStyle := [xfsBold];
FontName := 'Verdana';
end;

inc(vRow);
Range[0, vRow, 0, vRow].FillPatternForeColor := TXc12DefaultIndexColorPalette[Ord(xcGray25)];

inc(vRow);
asString[0, vRow] := asString[1, vRow];
asString[1, vRow] := '';
with Range[0, vRow, 0, vRow] do begin
FontSize := 10;
FontStyle := [xfsBold];
FontName := 'Verdana';
end;

//the following code has no effect
//add the borders
with Range[0, 4, 0, 4] do begin
BorderTopStyle := cbsMedium;
BorderBottomStyle := cbsMedium;
end;
with Range[0, 4, 0, FRow] do begin
BorderLeftStyle := cbsMedium;
BorderRightStyle := cbsThin;
end
end
end;
Post Reply