CopySheet does not protect the hidden feature of columns
Posted: Thu Dec 10, 2015 9:45 am
Hello,
I want to copy one sheet to new one with existing hidden columns, but in the new sheet all columns are visible.
I want to copy one sheet to new one with existing hidden columns, but in the new sheet all columns are visible.
Code: Select all
procedure TForm.Button1Click(Sender: TObject);
var
fn1, fn2: string;
Excel: TXlsReadWriteII5;
begin
fn1 := 'D:\Tests\Excel\temp1.xls';
fn2 := 'D:\Tests\Excel\temp2.xls';
Excel := TXLSReadWriteII5.Create(nil);
Excel.Filename := fn1;
Excel.Read;
// add new sheet and copy first one
Excel.Add;
Excel.CopySheet(0, 1);
Excel.SaveToFile(fn2);
Excel.Free;
end;