CopySheet and delete sheet do not adjust defined cell names
Posted: Thu Dec 10, 2015 8:58 am
Hello,
I want copy one sheet including defined a cell name to new sheet and when i delete the first sheet defined cell name is being invalid, not refereced the new sheet.
CopySheet do not adjust the new defined name
Defined simple cell Name like this name: c_one reference: =Sheet1!$C$1
Same code with TXlsReadWriteII works correct but not work in TXlsReadWriteII5
my test code
I want copy one sheet including defined a cell name to new sheet and when i delete the first sheet defined cell name is being invalid, not refereced the new sheet.
CopySheet do not adjust the new defined name
Defined simple cell Name like this name: c_one reference: =Sheet1!$C$1
Same code with TXlsReadWriteII works correct but not work in TXlsReadWriteII5
my test code
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);
// delete first one
Excel.Delete(0);
Excel.SaveToFile(fn2);
Excel.Free;
end;