Public API Changes in Aspose.Cells 8.6.3

Added APIs

Support for HTML Parsing while Importing Data

This release of Aspose.Cells for .NET API has exposed the ImportTableOptions.IsHtmlString property which directs the API to parse the HTML tags while importing data onto the Worksheet and set the parsed result as cell value. Please note, Aspose.Cells APIs already provide the Cell.HtmlString to perform this task for a single cell, however, while importing data in bulk such as from a DataTable, the ImportTableOptions.IsHtmlString property (when set to true) tries to parse all the supported HTML tags and sets the parsed results to the corresponding cells.

Here is the simplest usage scenario.

C#

 //create an instance of ImportTableOptions

var importOptions = new ImportTableOptions();

//Set IsHtmlString to true so that the API can parse the HTML

importOptions.IsHtmlString = true;

//Import data from DataTable while passing instance of ImportTableOptions

cells.ImportData(table, 0, 0, importOptions);

Method Workbook.CreateBuiltinStyle Added

Aspose.Cells for .NET 8.6.3 has exposed the Workbook.CreateBuiltinStyle method that can be used to create an object of the Style class that corresponds to one of the built-in styles offered by the Excel application. The Workbook.CreateBuiltinStyle method accepts a constant from the enumeration BuiltinStyleType. Please note, with previous releases of the Aspose.Cells APIs, same task could be accomplished via StyleCollection.CreateBuiltinStyle method but as the recent releases of Aspose.Cells APIs have removed the StyleCollection class therefore the newly exposed Workbook.CreateBuiltinStyle method can be considered as an alternative approach to achieve the same.

Following is the simple usage scenario.

C#

 //Create an instance of Workbook

//Optionally load a spreadsheet

var book = new Workbook();

//Create a built-in style of type Title

var style = book.CreateBuiltinStyle(BuiltinStyleType.Title);

Method Cells.ImportGridView Added

Aspose.Cells for .NET 8.6.3 has exposed an overloaded version of the Cells.ImportGridView that can now accept an instance of ImportTableOptions to give more control over the import process.

Following is the simple usage scenario.

C#

 //Create an instance of Workbook

//Optionally load a spreadsheet

var book = new Workbook();

//Retrieve the Cells collection of first Worksheet in Workbook

var cells = book.Worksheets[0].Cells;

//create an instance of ImportTableOptions & set its various properties

var importOptions = new ImportTableOptions();

importOptions.IsHtmlString = true;

importOptions.IsFieldNameShown = true;

//Import data from GridView while passing instance of ImportTableOptions

cells.ImportGridView(gridView, 0, 0, importOptions);

Property ImportTableOptions.ConvertGridStyle Added

In reference the above mentioned enhancements, the latest version of Aspose.Cells for .NET API has also exposed the ImportTableOptions.ConvertGridStyle property. This Boolean type property allows the developers to control the appearance of the imported data, where setting the ImportTableOptions.ConvertGridStyle property to true indicates that the API will apply the style of the GridView to the cells where data has been imported.

Following is the simple usage scenario.

C#

 //Create an instance of Workbook

//Optionally load a spreadsheet

var book = new Workbook();

//Retrieve the Cells collection of first Worksheet in Workbook

var cells = book.Worksheets[0].Cells;

//create an instance of ImportTableOptions

var importOptions = new ImportTableOptions();

//Set ConvertGridStyle property to true

importOptions.ConvertGridStyle = true;



//Import data from GridView while passing instance of ImportTableOptions

cells.ImportGridView(gridView, 0, 0, importOptions);

Property LoadDataOption.OnlyVisibleWorksheet Added

Aspose.Cells for .NET 8.6.3 has exposed the LoadDataOption.OnlyVisibleWorksheet property which upon setting to true will influence the loading mechanism of Aspose.Cells for .NET API, as a result only visible worksheets from a given spreadsheet will be loaded. Please check the detailed article on this subject.

Following is the simple usage scenario.

C#

 //Create an instance of LoadDataOption

var loadDataOptions = new LoadDataOption();

//Set OnlyVisibleWorksheet property to true

loadDataOptions.OnlyVisibleWorksheet = true;

//Create an instance of LoadOptions

var loadOptions = new LoadOptions();

//Set LoadDataOptions property to the instance of LoadDataOption created earlier

loadOptions.LoadDataOptions = loadDataOptions;



//Create an instance of Workbook & load an existing spreadsheet

//while passing the instance of LoadOptions created earlier

var book = new Workbook(inputFilePath, loadOptions);

Obsoleted APIs

Method Worksheet.CopyConditionalFormatting Obsoleted

As an alternative to the Worksheet.CopyConditionalFormatting method, it is advised to use any of the Cells.CopyRows or Range.Copy methods.

Property Cells.End Obsoleted

Please use Cells.LastCell property as an alternative to the Cells.End property.