Support for ActiveX Controls, Render Grid Lines in HTML, Auto Refresh OleObject’s Image and much more with Aspose.Cells for Java 8.8.3

Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Cells for JavaWe are pleased to announce the release of Aspose.Cells for Java 8.8.3. This release includes many new features and enhancements along with some critical bug fixes that further improve the overall stability and usability of the API. Please check the detailed 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. 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.

Support for ActiveX Controls

Aspose.Cells APIs have provided the ability to add & manipulate the ActiveX Controls in spreadsheets. Aspose.Cells for Java API has exposed a number of useful classes, enumerations and methods to fully support the ActiveX Controls. The most worth mentioning addition to the public API is the ShapeCollection.addActiveXControl method which allows to add an ActiveX Control to the collection of shapes by accepting 7 parameters to specify the control type, location to place the control and size of the control. The control type can be specified using the ControlType enumeration with following possible values.

  • ControlType.CHECK_BOX
  • ControlType.COMBO_BOX
  • ControlType.COMMAND_BUTTON
  • ControlType.IMAGE
  • ControlType.LABEL
  • ControlType.LIST_BOX
  • ControlType.RADIO_BUTTON
  • ControlType.SCROLL_BAR
  • ControlType.SPIN_BUTTON
  • ControlType.TEXT_BOX
  • ControlType.TOGGLE_BUTTON
  • ControlType.UNKNOWN

Below provided code snippet demonstrates the simple usage scenario of newly exposed ShapeCollection.addActiveXControl method to add an ActiveX Control of type Toggle Button. Please check the detailed article on Adding ActiveX Controls to Worksheets if you wish to get more in-depth understanding of the aforementioned feature.

//Create an instance of Workbook
Workbook book = new Workbook();

//Access first worksheet from the collection
Worksheet sheet = book.getWorksheets().get(0);

//Add Toggle Button ActiveX Control to the ShapeCollection at specified location
Shape shape = sheet.getShapes().addActiveXControl(ControlType.TOGGLE_BUTTON, 4, 0, 4, 0, 100, 30);

//Access the ActiveX Control object and set its linked cell property
ActiveXControl control = shape.getActiveXControl();
control.setLinkedCell("A1");

//Save the result on disc
book.save(dir + "output.xlsx", SaveFormat.XLSX);

Render Grid Lines to HTML

Aspose.Cells APIs provide the ability to export spreadsheet contents in HTML format as per the standards opted by Excel application. If a spreadsheet is converted to HTML using Excel application, it does not render the grid lines. Aspose.Cells APIs behave in the same way using its default settings, however, with this release of the API, the developers can now choose to render the grid lines as well. Aspose.Cells for Java API has exposed the HtmlSaveOptions.ExportGridLines property with default value of false. If the said property is set to true, the API renders the grid lines for the available data range in HTML format.

Below provided code snippet demonstrates the simple usage scenario of newly exposed HtmlSaveOptions.ExportGridLines to render the grid lines to HTML format. In order to get a more detailed understanding of this feature, please check the article on Rendering Grid Lines to HTML.

//Create an instance of Workbook and load existing spreadsheet
Workbook book = new Workbook(dir + "input.xlsx");

//Create an instance of HtmlSaveOptions
HtmlSaveOptions options = new HtmlSaveOptions();
//Set ExportGridLines to true
options.setExportGridLines(true);

//Save the result in HTML format
book.save(dir + "output.html", options);

Auto Refresh OleObject’s Image

Aspose.Cells for Java 8.8.3 has exposed the OleObject.AutoLoad property which allows to refresh the OleObject’s image if the contents/data of the underlying object has been changed. The aforementioned property when set to true, forces the Excel application to refresh the OleObject’s image when resultant spreadsheet is loaded in Excel interface.

Below provided code snippet demonstrates the simple usage scenario of newly exposed OleObject.AutoLoad property. In order to get a more detailed understanding of this feature, please check the article on Automatically Refresh OleObect’s Image.

//Create an instance of Workbook and load an existing spreadsheet
Workbook book = new Workbook(dir + "input.xlsx");

//Access first worksheet from the collection
Worksheet sheet = book.getWorksheets().get(0);

//Access OleObjectCollection from first worksheet
OleObjectCollection oleObjects = sheet.getOleObjects();

//Access a OleObject from the collection
OleObject oleObject = oleObjects.get(0);

//Set AutoLoad to true
oleObject.setAutoLoad(true);

Add Comments for ListObjects

Aspose.Cells APIs now allow to get and set the comments for an instance of ListObject. In order to provide the aforementioned feature, the Aspose.Cells APIs have exposed the ListObject.Comment property with the release of 8.8.3.

Here is a simple usage scenario of newly exposed ListObject.Comment property. In order to get detailed understanding of this feature, please check the article on Adding Comments for ListObjects.

//Create an instance of Workbook and load existing spreadsheet
Workbook book = new Workbook(dir + "input.xlsx");

//Access first worksheet from the collection
Worksheet sheet = book.getWorksheets().get(0);

//Access first ListObject from the collection of ListObjects
ListObject listObject = sheet.getListObjects().get(0);

//Set comments for the ListObject
listObject.setComment("Comments");

//Save the result on disc
book.save(dir + "output.xlsx");

Other Enhancements & Improvements

The most notable enhancements in this release are as follow:

Aspose.Cells for Java Resources

The resources, you may need to accomplish your tasks: