Hello aspose.cells Forums,
I have a multi-part question/inquiry...
I was using Aspose.Cells version 4.1.2.1 with an ASP.NET web app, and I have users who are using both Excel 2003 and 2007.
I am creating a PivotTable (see code below), and when the user saves the file, then opens it they receive the error message 'There is not enough memory to create the PivotTable Report.'.
I have since upgraded to the vesion 4.4.0.0, and now do not receive the above error message any longer, but the PivotTable does not even get created.
I have updated the save call to the below:
workbook.Save(fileName, FileFormatType.Excel2007Xlsx, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response);
Here is my code for creating the workbook, PivotTable, etc.
------------------------------------------------------------
Aspose.Cells.License license = new License();
license.SetLicense("Aspose.Cells.Lic");
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Name = rptName + "_DATA";
worksheet.Cells.ImportDataTable(ds.Tables["TC_DATA"], true, 0, 0);
ds.Dispose();
Column col = worksheet.Cells.Columns[4];
col.Style.Custom = "mm/dd/yyyy";
workbook.Worksheets.Add();
worksheet = workbook.Worksheets[1];
worksheet.Name = rptName;
worksheet.Move(0);
Cells cells = worksheet.Cells;
Cell cell = cells["A1"];
cell.PutValue("Testing");
PivotTables pivotTables = worksheet.PivotTables;
int rowCount = ds.Tables["TC_DATA"].Rows.Count + 1;
int colCount = ds.Tables["TC_DATA"].Columns.Count + 1;
//Adding a PivotTable to the worksheet
int index = pivotTables.Add("=" + rptName + "_DATA" + "!A1:P" + rowCount.ToString(), "A1", "pvtProjDetlRpt");
//Accessing the instance of the newly added PivotTable
PivotTable pivotTable = pivotTables[index];
//Unshowing grand totals for rows.
pivotTable.RowGrand = false;
//Draging the third field to the data area.
pivotTable.AddFieldToArea(PivotFieldType.Data, 13);
pivotTable.DataFields[0].Number = 4;
pivotTable.AddFieldToArea(PivotFieldType.Page, 2);
pivotTable.AddFieldToArea(PivotFieldType.Page, 3);
pivotTable.AddFieldToArea(PivotFieldType.Page, 6);
//Draging the first field to the row area.
pivotTable.AddFieldToArea(PivotFieldType.Row, 9);
// AutoSort the Field...
pivotTable.RowFields[0].IsAutoSort = true;
pivotTable.AddFieldToArea(PivotFieldType.Row, 10);
pivotTable.RowFields[1].IsAutoSort = true;
pivotTable.AddFieldToArea(PivotFieldType.Row, 1);
pivotTable.RowFields[1].IsAutoSort = true;
MembershipUser usr = Membership.GetUser();
string fileName = "PR_Mgr_ProjDetl_Emp_" + usr.UserName.ToUpper() + "_" + DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + ".xlsx";
workbook.Save(fileName, FileFormatType.Excel2007Xlsx, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response);
----------------------------------------------------------------
Your help is greatly appreciated, as this is causing a 'down-time' until I get a resolution to the problem.
Regards,
Mephisto.