Autofit Rows for Merged Cells and Import Data from JSON using Aspose.Cells for Android via Java v19.3

Share on FacebookTweet about this on TwitterShare on LinkedIn
Guys, I’m going to walk you through all the exciting features, improvements and other fixes of Aspose.Cells for Android via Java v19.3. This release includes new features, enhancements and other bug fixes that further improve the overall stability and usability of the Android API. For an easy access and utilization, Aspose.Cells for Android via Java APIs can be directly installed from Maven repository, see the document for your reference. Please check the release notes in order to get an idea about what is new and what has been fixed with this revision of Aspose.Cells for Android via Java. Let us start reviewing what is there in this release.

Insert rows with formatting

Microsoft Excel supports a feature to insert a row using one of the three different options. The objective of these options is to adopt settings from other rows. These three options include the following:
  • Format Same as Above (copy formatting from the above row)
  • Format Same as Below (copy formatting from the row below)
  • Clear Formatting (add new row but without any formatting)
You can also see these three options in the following screenshot:
Insert a row with one of the three formatting options
The good news is, using Aspose.Cells for Android via Java API, you can use this feature in your code as well. You can programmatically create new rows with specified formatting option. Here is a code sample for you to do just that along the documentation to insert row with formatting:

Replace special chars while opening a CSV file

There was a demand, from you guys, that just like Excel, Aspose.Cells supports replacing special characters while opening a CSV file. So, we're very excited to break the news that this feature is now supported in the API. Just have a look at the below example to see how easy it is to achieve this with Aspose.Cells for Android via Java.

Detect type of encrypted OOXML files

As you must already have some idea that Office Open XML, which is also known as OOXML or Microsoft Open XML (MOX), is a very common format used for files. It is an XML-based format developed by Microsoft for representing office documents like spreadsheets, charts, presentations, and word processing documents. Aspose.Cells already allowed to open and detect type of this format. But now, our team has gone a step forward, and supported to detect type of encrypted OOXML files. Check out the sample code below:

Import data from JSON

As you know that JavaScript Object Notation is a common data interchange format which is quite lightweight and can be read by human and machines easily. Now, for example, you get data from some Web API in JSON format and need it to be imported into some Excel file, then Aspose.Cells is there to provide this facility. JSONUtility class is introduced by Aspose.Cells for this purpose having ImportData method that not only imports data but also performs different conversions and formatting using the JsonLayoutOptions object during the import process. You may try this exciting feature by following article Importing Data from JSON. Here is a sample code to use this feature:
You can see that result is cool as fully formatted Excel file is created without using any extra code to parse the JSON string from any source like Web API. Isn't it? For example, if you get the following string from Web API, then output Excel file is shown in the image below: [{"color": "red","value": "#f00"},{"color": "green","value": "#0f0"},{"color": "blue","value": "#00f"},{"color": "cyan","value": "#0ff"},{"color": "magenta","value": "#f0f"},{"color": "yellow","value":"#ff0"},{"color": "black","value": "#000"}]

Convert table to range with Options

Conversion of the table to a range was available earlier. However what if you want to control the formatting of destination range like formatting only the partial output. The good news is that this feature is available now and you don't need to write extra code to format the output range. We have introduced a new class TableToRangeOptions where LastRow property is available to set the last row to which formatting is copied from the source table. Here is the view of a sample table and converted range which is formatted up to row 5.
Here is a sample code which is used to create the above range.
For detailed information on conversions follow this link.

Get Range with External Links

Microsoft Excel supports external links for fetching data from different sources. We have provided the option to retrieve these links from the Excel file using Name.GetRefferedAreas method. This method returns ReferredArea which has many useful properties as follows: In the following example, an external file having named range "Names" is linked with the Excel file. We can access this named range in the linked file and display its properties mentioned above.

Keep separators for blank rows during spreadsheet to CSV

Many times you convert the Excel sheets to CSV for using it in some other environment or applications. You may need to decide yourself about the separators for blank rows in the spreadsheet while exporting it to CSV. For example, there is a blank row in the source spreadsheet and you want either a blank row in the CSV or have a row with predefined separators. We have provided this feature now and you can get details about this feature here. For better understanding, have a look at the following image which shows the result of this feature.
Following is a sample code which demonstrates this new feature.

Autofit Rows for Merged Cells

Autofitting rows is a very common operation which you perform while working with the Excel files. This feature was already there in Aspose.Cells API however many people asked for more control over this operation. To fulfill this requirement we have provided AutoFitMergedCellsType enumerator which contains the following options:
  • NONE: Ignore merged cells.
  • FIRST_LINE: Only expands the height of the first row.
  • LAST_LINE: Only expands the height of the last row.
  • EACH_LINE: Expands the height of each row.
Here is a snapshot of this feature where the effect of one of the options EACH_LINE is shown.
You can test this feature using following sample code.
For more details on this topic please visit here.

Useful Links

The resources, you might need to accomplish your tasks: