Public API Changes in Aspose.Cells 8.9.0

Added APIs

Added HtmlSaveOptions.DefaultFontName Property

Aspose.Cells for Java 8.9.0 has exposed the DefaultFontName property for the HtmlSaveOptions class that allows you to specify the default font name while rendering spreadsheets to HTML format. The default font will be used only when the font in the style does not exist. The default value of HtmlSaveOptions.DefaultFontName property is null, which means Aspose.Cells for Java API will use a universal font that has the same family as the original font.

Following is the simple usage scenario.

Java

 //Create an instance of HtmlSaveOptions

HtmlSaveOptions options = new HtmlSaveOptions();

//Set default font name for Html rendering

options.setDefaultFontName("Arial");

//Load a spreadsheet into an instance of Workbook

Workbook book = new Workbook(dir + "sample.xlsx");

//Save the spreadsheet in Html format while passing instance of HtmlSaveOptions

book.save(dir + "output.html", options);

Added ImageOrPrintOptions.DefaultFont Property

Aspose.Cells for Java 8.9.0 allows you to set the default font name for the ImageOrPrintOptions class by exposing the DefaultFont property. The property can be used when Unicode characters in the spreadsheet are not set with the correct font in the cell style; otherwise such characters may appear as blocks in the resulting images.

Following is the simple usage scenario.

Java

 //Create an instance of ImageOrPrintOptions

ImageOrPrintOptions options = new ImageOrPrintOptions();

//Set default font name for image rendering

options.setDefaultFont("Arial");

//Load a spreadsheet into an instance of Workbook

Workbook book = new Workbook(dir + "sample.xlsx");

//Access the worksheet to be rendered

Worksheet sheet = book.getWorksheets().get(0);

//Create an instance of SheetRender

SheetRender render = new SheetRender(sheet, options);

//Save spreadsheet to image

render.toImage(0, dir + "output.png");

Added PivotTable.Excel2003Compatible Property

Aspose.Cells for Java API has exposed the Boolean‑type Excel2003Compatible property for the PivotTable class, which allows you to specify whether the PivotTable is Excel 2003 compatible for refreshing purposes. The default value of the Excel2003Compatible property is true, which means a string must be less than or equal to 255 characters. If the string is greater than 255 characters, it will be truncated. If false, the aforementioned restriction is not imposed.

Following is the simple usage scenario.

Java

 //Load a spreadsheet into an instance of Workbook

Workbook book = new Workbook(dir + "sample.xlsx");

//Access the desired Pivot Table from the spreadsheet

PivotTable pivot = book.getWorksheets().get(0).getPivotTables().get(0);

//Set Excel 2003 compatibility to false

pivot.setExcel2003Compatible(false);

//Refresh & recalculate Pivot Table

pivot.refreshData();

pivot.calculateData();