Aspose.Cells for Java

Aspose.Cells for Java API has been upgraded to 8.7.0, and we are pleased to announce, this month’s release contains many useful features and improvements along with some critical bug fixes. Please refer to the release notes of Aspose.Cells for Java 8.7.0 for a full list of enhancements. If you are planning to upgrade the API from any previous version, we strongly suggest you to check the Public API Changes section to know what has been changed since your current revision of the API.

While you are downloading the latest build, here is a look at the biggest features in this release.

Excel to PDF - Optimize PDF File Size

Aspose.Cells APIs have provided an enhancement for the PDF rendering engine in order to reduce the resultant PDF file size. Aspose.Cells for Java 8.7.0 has exposed the PdfSaveOptions.OptimizationType property along with an enumeration by the name PdfOptimizationType in order to facilitate the application developers to control the resultant PDF file size to some extent.

The PdfOptimizationType enumeration has 2 constants at the moment exhibiting the following behaviour.

  1. PdfOptimizationType.MINIMUM_SIZE: API tries to optimize the cell text and cell border records in order to reduce the resultant PDF file size.
  2. PdfOptimizationType.STANDARD: No optimization is done therefore the resultant file size will be large as compared to PdfOptimizationType.MINIMUM_SIZE selection.

The following piece of code demonstrates the usage of PdfSaveOptions.OptimizationType property to minimize the resultant PDF file size while exporting spreadsheets to PDF format.

Re-size Chart’s Data Label Shape to Fit Text

Aspose.Cells for Java 8.7.0 has exposed the boolean type DataLabels.ResizeShapeToFitText property in order to mimic the Excel’s feature of re-sizing data label shapes to fit the text.

Please note, Excel application provides the Resize shape to fit text option for chart’s data labels to increase the size of the shape so that the text fits inside of it. This option can be accessed on Excel interface by selecting any of the data labels on the chart. Right click and select Format DataLabels menu. On Size & Properties tab, expand Alignment node to reveal the related properties including the Resize shape to fix text option as highlighted below.

The following piece of code shows the simple usage scenario of DataLabels.ResizeShapeToFitText property to re-size the chart’s data label shapes to fit text.

Here is a snapshot showing a simple bar chart before & after executing the above code.

Enhancements to Protection Module

Aspose.Cells APIs have enhanced the Protection class by introducing some useful properties & methods. Two of the most worth mentioning enhancements are as follow.

Detect if Worksheet is Password Protected

It is possible to protect the workbooks and worksheets separately. For instance, a spreadsheet may contain one or more worksheets that are password protected, however, the spreadsheet itself may or may not be protected. Aspose.Cells API for Java has provided the Protection.isProtectedWithPassword field to detect if a worksheet is password protected. Boolean type Protection.isProtectedWithPassword field returns true if Worksheet is password protected and false if not.

Verify Password Used to Protect the Worksheet

Aspose.Cells for Java 8.7.0 has exposed the Protection.verifyPassword method which allows to specify a password as an instance of String and verifies if same password has been used to protect the worksheet. The Protection.verifyPassword method returns true if the specified password matches with the password used to protect the given Worksheet, false if the specified password does not match.

The following piece of code uses the Protection.verifyPassword method in conjunction with Protection.isProtectedWithPassword field to detect password protection and verifies the password.

Load or Import Delimited File Containing Formulas

Aspose.Cells for Java has provided support to identify & parse the formulas while loading CSV/TXT files having delimited plain data. Newly exposed TxtLoadOptions.HasFormula property when set to true directs the API to parse the formulas from the input delimited file and set them to relevant cells without requiring any additional processing.

The following piece of code demonstrates the usage of TxtLoadOptions.HasFormula property to load and import the CSV with formulas in it.

Create 2-Color Scale Conditional Format

This release of the API has has exposed the ColorScale.Is3ColorScale property that can be used to create 2-Color Scale conditional format. The said property is of type boolean with default value of true which means that the conditional format will be of 3-Color Scale by default. However, switching the ColorScale.Is3ColorScale property to false will generate a 2-Color Scale conditional format.

Following is the simple usage scenario to generate 2-color scale conditional format. Please also review the detailed article on Adding 2 & 3-Color Scale Conditional Formatting.

Other Enhancements & Improvements

The most notable enhancements in this release are as follow:

  • Newly exposed field VbaProject.isSigned allows to detect if a given VbaProject is digitally signed or not.
  • This release has added support for importing XML map inside an instance of Workbook.
  • Enhanced the PDF rending engine to maximize the fidelity for the Excel Chart objects.

Aspose.Cells for Java Resources

The resources, you may need to accomplish your tasks: