We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Cells Protection settings lost when saved via the Grid Web control

My application first creates a worksheet using Aspose.Cells verion 7.3.

The worksheet is protected with the following code:

Protection protection = workbook.Worksheets[0].Protection;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

protection.AllowInsertingRow = true;

protection.AllowDeletingRow = true;

protection.AllowSelectingLockedCell = true;

worksheet.Protect(ProtectionType.All);

This spreadsheet is correctly protected, the correct cells are locked and rows can be inserted.

However, the second step in the application is to make the generated spreadsheet available on a web page via Aspose.Cells.GridWeb version 2.7.8.200. The user can save the generated spreadsheet by clicking the save button.

<acw:GridWeb onsavecommand="GridSaveCommand"

protected void GridSaveCommand(object sender, EventArgs e)

{

MemoryStream memoryStream = new MemoryStream();

billGrid.WebWorksheets.SaveToExcelFile(memoryStream);

Response.ContentType = "application/vnd.ms-excel";

Response.AddHeader("content-disposition", "attachment; filename=" + ConfigurationManager.AppSettings["DefaultFileSaveName"]);

Response.OutputStream.Write(memoryStream.GetBuffer(), 0, (int)memoryStream.Length);

Response.End();

}

The spreadsheet saved via Aspose.Cells.GridWeb is fully protected and does NOT ALLOW THE USER TO INSERT ANY ROWS. How did it lose its protection settings of AllowInsertingRow?

Hi,

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

Please also provide us your runnable but simple source project replicating this issue.

So that we could run your project on our end and investigate this issue and if there is some bug, we will log it in our database.

Thanks for your help.

A test solution is attached.

First, run the unit test to generate a worksheet. This worksheet is protected and correctly allows the user to insert new rows. The column widths are also correctly. See the inclosed image called GoodWorksheet.png.

Second run the web page which displays the exact same spreadsheet in a Grid View. Then, click the save button. This worksheet should be the exactly same as above. However, it does not allow the user to insert new rows and the column widths are not set correctly.

Hi,

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

I was able to replicate this issue as you have mentioned with the latest version:
Aspose.Cells
for GridWeb v2.7.9.2000


We will soon look into this issue and fix the problem. Once the issue is resolved, we will update you asap.

This issue has been logged as CELLSNET-40996.

I have attached the source and the output xls file and screenshots highlighting the problem. I have generated the output xls file using the following code with the latest:
Aspose.Cells
for GridWeb v2.7.9.2000


As you can see in the screenshot, insert and delete context menu items are disabled.

I have also attached the sample test gridweb project replicating this issue with the latest version for a reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xls”;


MyGrid.WebWorksheets.ImportExcelFile(filePath);

MyGrid.WebWorksheets.SaveToExcelFile(filePath + “.out.xls”);

Screenshot:

Hi,

We have looked into your issue and found that this is a New Feature and not yet supported.

It is a complex feature so we are afraid that we cannot support it anytime soon.

Thanks for your understanding.

I disagree with the statement that this is a new feature. The worksheet looks one way when it is created with Aspose.Cells and is different when it is displayed in Aspose.Cells.GridWeb. Is consistency between the two tools a new feature?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hi,


Shakeel Fiaz is right as it is a new feature rather enhancement of Aspose.Cells.GridWeb control. Actually Aspose.Cells.GridWeb is not the part of Aspose.Cells component/library but a different and independent control (web grid control), both component and the control have different sets or architecture and features/attributes, so we have to make proper support of Protection settings for GridWeb, so that it could read the file with proper Protection settings (applied in the Excel file) and write to the file (on path/disk). It looks that some protection configuration/settings are not properly supported by Aspose.Cells.GridWeb. We will look into it to figure it out soon.

Thank you.