Hi,
We have got an visual issue that Excel pop up a warning message after a pivot table is created in an xlsm file when it is opened in Excel 2007. The reason we raise it is because it is causing some stress on our client side. A template xlsm file for testing and an image which describes the sympton are attached.
To reproduce this issue, please run the following code against the template file:
Workbook targetworkbook;
targetworkbook =new Workbook(txtTargetFile.Text);Worksheet targetsheet = targetworkbook.Worksheets["Sheet1"];
//Getting the pivottables collection in the sheet
Aspose.Cells.Pivot.PivotTableCollection pivotTables = targetsheet.PivotTables;
//Adding a PivotTable to the worksheet
int index = pivotTables.Add("=Formulated!C3:F12", “a3”, “pivot1”);
//Accessing the instance of the newly added PivotTable
Aspose.Cells.Pivot.PivotTable pivotTable = pivotTables[index];
//Showing the grand totals
pivotTable.RowGrand =true;
pivotTable.ColumnGrand = true;//Setting the PivotTable report is automatically formatted
pivotTable.IsAutoFormat = true;
//Setting the PivotTable autoformat type.
pivotTable.AutoFormatType = Aspose.Cells.Pivot.PivotTableAutoFormatType.Report6;
//Draging the first field to the row area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Row, 0);
//Draging the third field to the row area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Row, 2);
//Draging the second field to the row area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Row,1);//Draging the fourth field to the column area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Column, 3);
targetworkbook.Save(txtTargetFile.Text);--------------------------------------------------------------------------
You may need to adjust some of the code for testing. If you need anything else from us, please don’t hesitate to let us know.
Thanks and regards
Bill