Protect VBA Project of Excel with Password using Java

Aspose.Cells for Java

Aspose team is pleased to announce the release of Aspose.Cells for Java 17.4.0. This release includes many new features and enhancements along with some critical bug fixes that further improve the overall stability of the API. Please check the release notes in order to get an idea about what is new and what has been fixed with this revision of Aspose.Cells for Java. Here is a look at the major features in this release.

Protect VBA Project of Excel Workbook with Password

Aspose.Cells now supports the feature of protecting the VBA (Visual Basic for Applications) Project of Excel Workbook and locking it for viewing. Besides, you can also find if the existing VBA project is already protected or locked for viewing. Please see these articles for a reference.

The following snippet demonstrates how to protect your Excel Workbook VBA Project dynamically using Aspose.Cells and lock it for viewing.

//Load your source Excel file.
Workbook wb = new Workbook(dirPath + "samplePasswordProtectVBAProject.xlsm");
  
//Access the VBA project of the workbook.
VbaProject vbaProject = wb.getVbaProject();
  
//Lock the VBA project for viewing with password.
vbaProject.protect(true, "11");
  
//Save the output Excel file.
wb.save(dirPath + "outputPasswordProtectVBAProject.xlsm");

Specifying Sort Warning While Sorting Data

Aspose.Cells already supports Data Sorting, however earlier you could not specify that you want to sort your textual data as numerical data. For this purpose, Aspose.Cells implemented the DataSorter.SortAsNumber property. Whenever you sort textual data that looks like a number, MS-Excel shows this warning. DataSorter.SortAsNumber property implements this MS-Excel warning.

Please see this article for more help relating to this topic.

Specifying DBNum Custom Pattern Formatting

Aspose.Cells supports the DBNum custom pattern formatting. For example, if your cell value is 123 and you specify its custom formatting as [DBNum2][$-804]General then it will be displayed like 壹佰贰拾叁. You can specify custom formatting of your cell using Cell.getStyle() and Style.setCustom() methods.

Aspose.Cells for Java Resources

The resources, you may need to accomplish your tasks: