Hello,
I have an Excel sheet with a pivot table.
With Excel, when I copy the sheet to another sheet, the pivot table is retained.
With Flexcel (InsertAndCopySheets), the PivotTable is not preserved.
How can I keep the pivot tables set up in the sheet?
Excel sample file (test.xlsx) is available at:
http://dl.free.fr/getfile.pl?file=/TWSFr8QW
Here is an example:
Uses FlexCel.XlsAdapter, VCL.FlexCel.Core;procedure TForm1.Button1Click(Sender: TObject);varExcelFile: TExcelFile;beginExcelFile:= TXlsFile.Create(true);tryif FileOpenDialog1.Execute thenbeginExcelFile.Open(FileOpenDialog1.FileName);ExcelFile.InsertAndCopySheets(1, ExcelFile.SheetCount+1, 1);ExcelFile.Save(ExtractFilePath(FileOpenDialog1.FileName)+ ExtractFileName(FileOpenDialog1.FileName)+ '_Save'+ ExtractFileExt(FileOpenDialog1.FileName));end;finallyExcelFile.Free;end;end;