Aspose.Cells .NET: support for Excel 2007 features

Hello,


I am evaluating two Excel components: Aspose.Cells and TMSSoftware’s FlexCel. I’m specifically looking for Excel 2007 support of the following features:

- Sheet, row and cell-level locking via protection. Specifically:
- Lock rows entirely (no new rows or deleted rows)
- Lock specific cells from edits
- Hide/Lock an entire sheet

- Ability to carry through add-ins in an existing worksheet or add add-ins to a newly generated worksheet.

- Ability to add auto-filter to specific columns

According to this in your overview (https://docs.aspose.com/cells/net/product-overview) these features are supported, but are they fully supported in Excel 2007? I have been working more with FlexCel, and have recently discovered that they do not support row/cell level locking in the .xslx format.

Thank you for your time,
Jim

This message was posted using Page2Forum from Product Overview - Aspose.Cells for .NET

Hi Jim,

Thanks for considering Aspose.

Aspose.Cells for .NET supports your desired features for Excel 2007 formats.

For your desired features:

  • Sheet, row and cell-level locking via protection. Specifically:
  • Lock rows entirely (no new rows or deleted rows)
  • Lock specific cells from edits
  • Hide/Lock an entire sheet

Yes, these features are supported for Excel 2007 formats, see the sample examples below:

  1. To protect an entire sheet in an existing Excel 2007 Xlsx file.
    //Instantiating a Workbook object
    Workbook excel = new Workbook();
    //Creating a file stream containing the Excel file to be opened
    FileStream fstream = new FileStream(“e:\test\Book1.xlsx”, FileMode.Open);
    //Opening the Excel file through the file stream
    excel.Open(fstream,FileFormatType.Excel2007Xlsx);
    //Accessing the first worksheet in the Excel file
    Worksheet worksheet = excel.Worksheets[0];
    //Protecting the worksheet with a password
    worksheet.Protect(ProtectionType.All, “amjad”, null);
    //Saving the modified Excel file in default (that is Excel 20003) format
    excel.Save(“e:\test\outputBook1.xlsx”);
    //Closing the file stream to free all resources
    fstream.Close();

  2. To Protect some cells in a sheet for Excel 2007 Xlsx format.
    // Create a new workbook.
    Workbook wb = new Workbook();
    // Create a worksheet object and obtain the first sheet.
    Worksheet sheet = wb.Worksheets[0];
    // Define the style object.
    Style style;
    //Define the styleflag object
    StyleFlag styleflag;
    // Loop through all the columns in the worksheet and unlock them.
    for (int i = 0; i <= 255; i++)
    {

style = sheet.Cells.Columns[(byte)i].Style;
style.IsLocked = false;
styleflag = new StyleFlag();
styleflag.Locked = true;
sheet.Cells.Columns[(byte)i].ApplyStyle(style, styleflag);

}

// Lock the three cells…i.e. A1, B1, C1.
style = sheet.Cells[“A1”].Style;
style.IsLocked = true;
sheet.Cells[“A1”].Style = style;
style = sheet.Cells[“B1”].Style;
style.IsLocked = true;
sheet.Cells[“B1”].Style = style;
style = sheet.Cells[“C1”].Style;
style.IsLocked = true;
sheet.Cells[“C1”].Style = style;

// Finally, Protect the sheet now.
sheet.Protect(ProtectionType.All);
// Save the excel file.
wb.Save(“e:\test\lockedcells.xlsx”);

For further reference, please see the documents:

  • Ability to carry through add-ins in an existing worksheet or add add-ins to a newly generated worksheet.

You may set add-ins formulas, see the document: