Pivot table help


#1

Laurence,

I have an .xls where the first 5 sheet have pivot table on them. Now what is currently done manually is that the 6th sheet is populated with data and that data is used by the pivot table on the first 5 sheets. I want to do this programmatically. I took a sample .xls and strip out the data on the 6th sheet and I am using Aspose to populate the sheet. However, how do I assign each pivot table a data source in code.

Here is what I have so far:

templateSheet = xlApp.Worksheets[5];
templateSheet.Name = UserID;
selectedCells = templateSheet.Cells;
selectedCells.ImportDataTable(DataSource,
true, 1, 0);

Range range = templateSheet.Cells.CreateRange(1, 0, DataSource.Rows.Count, DataSource.Columns.Count);
range.Name = “DataRange”;

Please provide some sample code. I saw another example on a similat thread but did not have enough info to do what I wanted.

Thanks,
Jean

#2

Hi Jean,

Please check http://www.aspose.com/wiki/default.aspx/Aspose.Excel/PivotTable.html for reference.