Hi,
Thanks for considering Aspose.
Well, Aspose.Grid.Web is optimized to load/manipulate huge excel files in quick time.
Could you elaborate how do you load data to the sheet? From file or database? How do you set styles for your data in the worksheets. If you set styles for each cell, a lots of TableItemStyle objects will be generated. I suggest to create Grid styles for the grid, use the GridWeb.CustomStyleFileName property, and use the GridWeb Designer to create the style file. And only set styles for the different cells. That will save a lot of memory and enhance the performance.
If you want to use session or viewstate to store the sheet data, you should mantain the sheet's state manually. There are 3 session mode: Session, ViewState and Custom. If you want to edit the grid's content in Custom SessionMode, you should recover the grid's data state in each request before the post data updates the grid. The following is an example of custom session mode using a temp file. The first time the grid loads data, it save its content to an "AGW2" format file. And in the LoadCustomData event, it loads data from the "AGW2" file. And each time the grid's data is updated, it saves the newest content back to the "AGW2" file in the SheetDataUpdated event. So we keep the grid's session state in a temp file, without any cost of Memory.
Here is an example for manually mantain the session:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
GridWeb1.SessionMode = SessionMode.Custom;
// Loads the initial data, from file or database.
GridWeb1.WebWorksheets.ImportExcelFile("d:/misc/test.xls");
// Saves the session data.
GridWeb1.SaveAGW2File("d:/sessiondata/save.agw2");
}
}
private void GridWeb1_SheetDataUpdated(object sender, System.EventArgs e)
{
// Handles the SheetDataUpdated event.
// Saves the session data for each update.
GridWeb1.SaveAGW2File("d:/sessiondata/save.agw2");
}
private void GridWeb1_LoadCustomData(object sender, System.EventArgs e)
{
// Handles the LoadCustomData event.
// Loads the session data.
GridWeb1.LoadAGW2File("d:/sessiondata/save.agw2");
}
If you still find any issue, kindly create a sample test project and post us here with all the files, we will check it soon.
Thank you.
Amjad Sahi
Support Developer,
Aspose Nanjing Team
Contact Us