WebWorksheets.SaveToExcelFile is not working for last updated Cell

Hi Aspose,

I am using Aspose GridWeb to display and edit a excel sheet in web browser.
For saving the same excel sheet(after editing) i am using the following method

MYAsposeGridWeb.WebWorksheets.SaveToExcelFile(filePath, Aspose.Cells.GridWeb.Data.FileFormatType.Excel2007);

The above method i am calling inside my custom save button click(not aspose default save button).
This code is not working for last updated cell value means “suppose i edit a cell value and then clicking on save button then its not saving that particular cell value, but it is working if i am clicking anywhere outside of that cell and then clicking the save button.”

Please suggest me any cell leave event or cell updated event i need to call or any other inbuilt solution for this issue.
Waiting for your response.

Thank you

Hi,


Thank you for using Aspose.Cells.

For your needs, one of the work around may be to change the Active Cell programatically on the click event of your button and then saving your file, like:

WebCell cell = sheet.Cells[“Some Cell other than your last Cell being edited”];

GridWeb1.ActiveCell = cell;

//Save the file now.

Also, please download and use this latest version: Aspose.Cells for GridWeb v2.7.7.2002

Hi,

When you use your own Asp.Net button, you have to add a line for the button to sink GridWeb's updated data/events, for example, you may add this line for the button into the Form_Load event:
e.g
//.........
if (!IsPostBack)

{

Button1.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();";
}

Hope, this will work for you.

Hi Aspose,

Thank you for your response but its not working in my page.
Here is my code i am calling in my button click.
WebCell cell = GridWeb1.WebWorksheets.ActiveSheet.Cells[0, 1];
GridWeb1.ActiveCell = cell;
GridWeb1.WebWorksheets.SaveToExcelFile(filePath, Aspose.Cells.GridWeb.Data.FileFormatType.Excel2007);

Let me clarify my problem once.
Suppose i am editing five different cells in gridweb and after edited the fifth cell i am clicking the save button then i am able to save the value of four cells except the last(fifth) one.

and same for the later answer also.

Thank You.

Hi,


Please follow the method as mentioned by Amjad in the earlier post and let us know your feedback please.

Hi Aspose,

Thanks for your quick response even that one is also not working and i am not sure on that code implementation.
“GridWeb1.updateData(); return GridWeb1.validateAll();”;
here updateData() and validateAll() is a inbuilt method or i need to create that function?

Hi,


Thank you for your feedback.

Can you please confirm us if you have added the mentioned line of code in the Page_Load event of your event? Your code should look something like this:

protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
Button1.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();";

//your other code.
} }

The updateData and validateData methods provide support to submit the GridWeb's data for an Asp.NET button to the server, if you are inserting data in the button's click event handler.

Hi Aspose,

Sorry for following you again and again but non of these solution working.

Can u please suggest me any way to change the focus of last updated cell on my button click so that it will work.

Thank You,

Hi,


In case of custom button, the above mentioned method should work. I have tested it. Please provide us with your sample runnable project, so that we can look into it and assist you further.