Aspose.Cells for Java API has been upgraded to 8.6.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.6.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.
Manipulate Document Properties with WorkbookMetadata
Aspose.Cells for Java API has exposed the WorkbookMetadata class that is light weight as compared to Workbook class and allows to load the spreadsheet in order to manipulate the document properties in a simpler & more efficient way. In addition to the aforesaid class, the Aspose.Cells for Java 8.6.0 has also exposed the MetadataOptions class and MetadataType enumeration that can be used to specify the type of properties to be updated.
Following code snippet demonstrates how to use the newly exposed WorkbookMetadata & MetadataOptions classes to add a custom property to the spreadsheet while using Aspose.Cells for Java API.
//Open Workbook metadata while specifying the appropriate MetadataType MetadataOptions options = new MetadataOptions(MetadataType.DOCUMENT_PROPERTIES); WorkbookMetadata metaWorkbook = new WorkbookMetadata("sample.xlsx", options); //Set some properties metaWorkbook.getCustomDocumentProperties().add("test", "test"); //Save the metadata information to the spreadsheet file metaWorkbook.save("output.xlsx");
Assign Macros to Shapes
Aspose.Cells for Java now provides the Shape.MarcoName property to assign the macros to any control in the spreadsheet. This property is useful in scenarios where application requirement is to add modules and assign them to the controls for user interaction.
The following sample code explains the usage of Shape.MarcoName property to assign a simple newly added module to button click event.
//Create a new Workbook object Workbook workbook = new Workbook(); //Get the instance of first default worksheet Worksheet sheet = workbook.getWorksheets().get(0); //Add a new module to the first worksheet int moduleIdx = workbook.getVbaProject().getModules().add(sheet); //Get the instance of newly added module VbaModule module = workbook.getVbaProject().getModules().get(moduleIdx); //Add module code module.setCodes("Sub ShowMessage()" + "\r\n" + " MsgBox \"Welcome to Aspose!\"" + "\r\n" + "End Sub"); //Create a new button to the worksheet and set its various properties Button button = (Button) sheet.getShapes().addShape(MsoDrawingType.BUTTON, 2, 0, 2, 0, 28, 80); button.setPlacement(PlacementType.FREE_FLOATING); button.getFont().setName("Tahoma"); button.getFont().setBold(true); button.getFont().setColor(Color.getBlue()); button.setText("Aspose"); //Assign the newly added module to the button button.setMacroName(module.getName() + ".ShowMessage" ); //Save the spreadsheet in XLSM format workbook.save("output.xlsm");
Restrict the Generation of Frame Scripts for HTML Conversion
Aspose.Cells for Java 8.6.0 has exposed the HtmlSaveOptions.ExportFrameScriptsAndProperties property that can be used to control the generation of scripts such as Frames & Document Properties while exporting the spreadsheets in HTML format. The aforesaid boolean type property has the default value of true, that means; the resultant HTML will contain the scripts related to the frames as per standards of Excel application. Moreover, the resultant HTML code will contain the conditional comments that detects the browser type and adjusts the layout accordingly. Setting this property to false will direct the Aspose.Cells APIs not to generate the frame scripts and conditional comments. In this case the resultant HTML can be viewed in any browser but it cannot be imported back while using Aspose.Cells APIs.
Other Enhancements & Improvements
The most notable enhancements in this release are as follow:
- Exposed OoxmlSaveOptions.UpdateZoom property that can be used to update the PageSetup.Zoom if PageSetup.FitToPagesWide and/or PageSetup.FitToPagesTall properties have been used to control the Worksheet scaling.
- Improved the HTML & PDF rendering engines for alignment, layout and shape rendering while handling ODS and other spreadsheet formats.
- Improved the calculation engine to provide support for CORREL, RSQ , STEYX Excel functions.
Aspose.Cells for Java Resources
The resources, you may need to accomplish your tasks:
- Home page for Aspose.Cells for Java API.
- Download Aspose.Cells for Java.
- Aspose.Cells for Java online documentation – help documentation and API reference documents.
- Aspose.Cells Product Family Forum – post your technical questions and queries, or any other problem you are facing while working with Aspose.Cells APIs.
- Enable blog Subscription – Do not limit yourself, you can keep yourself updated with the latest news on Aspose.Cells APIs, new features, fixes and other API related topics by subscribing to Aspose.Cells blog.
- Aspose.Cells for Java Examples – We have published our code examples on the social coding website GitHub.com. Anyone could explore the code examples for learning purposes.