Free Support Forum - aspose.com

Get evaluation notice when usng workbook.save to stream

When I apply page formatting and then save the workbook I get the evaluation notice. I have the license file referenced in the page load and get no error when I use the response.writefile method


My code:
Page_Load
Aspose.Cells.GridWeb.License license = new Aspose.Cells.GridWeb.License();
license.SetLicense(“Aspose.Total.lic”);

string filename = System.IO.Path.GetTempPath() + Session.SessionID + “.xls”;
this.GridWeb1.WebWorksheets.SaveToExcelFile(filename);
Workbook workbook = new Workbook(filename);
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
worksheet.PageSetup.Orientation = PageOrientationType.Landscape;
worksheet.PageSetup.BottomMargin = 0.5;
worksheet.PageSetup.FooterMargin = 0.5;
worksheet.PageSetup.HeaderMargin = 0.5;
worksheet.PageSetup.LeftMargin = 0.5;
worksheet.PageSetup.RightMargin = 0.5;
worksheet.PageSetup.TopMargin = 0.5;
workbook.Save(HttpContext.Current.Response, “sheet.xls”, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
Response.ContentType = “application/vnd.ms-excel”;
Response.AddHeader(“content-disposition”, “attachment; filename=” + excelName + “.xls”);
Response.WriteFile(filename);
Response.End();

Hi,

Thanks for your posting and using Aspose.Cells and GridWeb.

You are setting the Aspose.Cells.GridWeb.License, you should also set the Aspose.Cells.License.

Please add the following lines so that license could be set for both of the above classes.

C#


//Setting the license for GridWeb

Aspose.Cells.GridWeb.License gridLicense = new Aspose.Cells.GridWeb.License();

gridLicense.SetLicense(“Aspose.Total.lic”);


//Setting the license for Aspose.Cells

Aspose.Cells.License cellsLicense = new Aspose.Cells.License();

cellsLicense.SetLicense(“Aspose.Total.lic”);


For more help, please see the following document for your reference.