There is a problem in column delete operation

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
ykarapinar
Posts: 22
Joined: Fri May 17, 2013 7:59 am

There is a problem in column delete operation

Post by ykarapinar »

There is a problem in column delete operation in Excel file with unified columns

I have unified [B1:C1] and [D1:G1] cells. Then I deleted [D] and columns.
After delete operation only [C1:E1] cells were supposed to stay unified but, [B1:C1] and [D1:G1] cells were unified.

var
col, row: Integer;
begin
XLSReadWriteII51.FileName:='C:\XLSRW1.xlsx';
XLSReadWriteII51[0].MergeCells(1, 0, 2, 0);
XLSReadWriteII51[0].MergeCells(3, 0, 6, 0);

XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderInsideVertStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderInsideHorizStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderOutlineStyle := cbsThin;

XLSReadWriteII51.CmdFormat.BeginEdit(XLSReadWriteII51[0]);
XLSReadWriteII51.CmdFormat.Clear;
XLSReadWriteII51.CmdFormat.Fill.BackgroundColor.RGB:=clSilver;
XLSReadWriteII51.CmdFormat.Apply(0, 0, 7, 1);
for col:=0 to 7 do
for row:=0 to 55 do
XLSReadWriteII51.Sheets[0].AsString[col, row]:='[' + IntToStr(col) + ':' + IntToStr(row) + ']';

XLSReadWriteII51.DeleteColumns(0, 3, 3);
XLSReadWriteII51.DeleteColumns(0, 1, 1);

XLSReadWriteII51.Write;
end;



There is a problem in column delete operation of Excel files with number of lines greater than 256

When column [G] is deleted in an Excel file with 8 columns and 5000 lines;
Cell [G] and [H] contents are deleted up to line 256, all input stays remained after line number 256.

var
col, row: Integer;
begin
XLSReadWriteII51.FileName:='C:\XLSRW2.xlsx';

XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderInsideVertStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderInsideHorizStyle := cbsThin;
XLSReadWriteII51.Sheets[0].Range.ItemsRef['A1:H2'].BorderOutlineStyle := cbsThin;

XLSReadWriteII51.CmdFormat.BeginEdit(XLSReadWriteII51[0]);
XLSReadWriteII51.CmdFormat.Clear;
XLSReadWriteII51.CmdFormat.Fill.BackgroundColor.RGB:=clSilver;
XLSReadWriteII51.CmdFormat.Apply(0, 0, 7, 1);

for col:=0 to 7 do
for row:=0 to 5000 do
XLSReadWriteII51.Sheets[0].AsString[col, row]:='[' + IntToStr(col) + ':' + IntToStr(row) + ']';

XLSReadWriteII51.DeleteColumns(0, 6, 6);

XLSReadWriteII51.Write;
end;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: There is a problem in column delete operation

Post by larsa »

Hello

This is fixed in update 5.10.25
Lars Arvidsson, Axolot Data
Post Reply