Tile picture as a Texture inside shapes and set default font when rendering to PDF or image file with other enhancements in Aspose.Cells for Android via Java 17.9

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Aspose.Cells for Android logoWe are pleased to announce the release of Aspose.Cells for Android via Java 17.9. This release includes a number of new features, enhancements and several bug fixes that further improve the overall stability and usability of the API. 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. While you are downloading the latest build, here is a look at the most worth mentioning features in this release.

Tile Picture as a Texture inside the Shape

Aspose.Cells supports image tiling feature which allows you to display images that are too large to be displayed entirely as a single unit on a typical computer. The feature allows you to display by segmenting it into smaller, more manageable image tiles.

//Load sample Excel file
Workbook wb = new Workbook(dirPath + "e:\\test2\\Book1.xlsx");

//Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);
  
//Access first shape inside the worksheet
Shape sh = ws.getShapes().get(0);
  
//Tile Picture as a Texture inside the Shape 
sh.getFill().getTextureFill().setTiling(true);

//Save the output Excel file
wb.save(dirPath + "e:\\test2\\out1.xlsx");

Please see this article that explains how to Tile Picture as a Texture inside the Shape.

Using Formula parameter in Smart Marker field

Sometimes, you need to embed formula in Smart Markers. Aspose.Cells allows you to make use of Formula parameter in Smart marker field. For more detail, please see this article.

Apply Advanced Filter of Microsoft Excel to Display Records Meeting Complex Criteria

Microsoft Excel allows you to apply Advanced Filter on worksheet data to display records that meet complex criteria. You can apply Advanced Filter with Microsoft Excel via its Data > Advanced command as shown in this screenshot.

Aspose.Cells also allows you to apply the Advanced Filter using the Worksheet.advancedFilter() method. For more detail, please see this article.

Import Data from Microsoft Access Database ResultSet Object to the Worksheet

Aspose.Cells can import data to worksheet from ResultSet object which can be created from any database. However, the following article specifically creates ResultSet object from Microsoft Access Database. Since, the code is same for all types of databases, so you can use it in general.

Implement Errors and Boolean Value in Russian or Any Other Language

If you are using Microsoft Excel in Russian Locale or Language or any other Locale or Language, it will display Errors and Boolean values according to that Locale or Language. You can achieve the similar behavior of Microsoft Excel using Aspose.Cells with the GlobalizationSettings class. Please see the following article for more help.

Read Numbers Spreadsheet Developed by Apple Inc. using Aspose.Cells

Numbers is a spreadsheet application developed by Apple Inc. Aspose.Cells can read Numbers spreadsheet but it does not support writing to it. It can read Numbers spreadsheet’s Data, Style and Formulas. Here is the article link for more detail.

Set DefaultFont property of PdfSaveOptions and ImageOrPrintOptions

When saving to PDF or image, Aspose.Cells will first try to use Workbook’s default font. This behavior can be changed using DefaultFont attribute in PdfSaveOptions/ImageOrPrintOptions. For more detail, please see this article.

Determine if Paper Size of Worksheet is Automatic

Most of the time, paper size of the worksheet is automatic. When it is automatic, it is often set as Letter. Sometime user sets the paper size of the worksheet as per their requirements. In this case, the paper size is not automatic. You can find if the worksheet paper size is automatic or not using the Worksheet.getPageSetup().isAutomaticPaperSize() method.

Output Blank Page when there is Nothing to Print

If the sheet is empty, then Aspose.Cells will not print anything when you export worksheet to image. You can change this behavior by using the ImageOrPrintOptions.OutputBlankPageWhenNothingToPrint property. When you will set it true, it will print the blank page.

// Create workbook
Workbook wb = new Workbook();
 
// Access first worksheet - it is empty sheet
Worksheet ws = wb.getWorksheets().get(0);
 
// Specify image or print options
// Since the sheet is blank, we will set OutputBlankPageWhenNothingToPrint to true
// So that empty page gets printed
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.setImageFormat(ImageFormat.getPng());
opts.setOutputBlankPageWhenNothingToPrint(true);
 
// Render empty sheet to png image
SheetRender sr = new SheetRender(ws, opts);
sr.toImage(0, dirPath + "OutputBlankPageWhenNothingToPrint.png");

Export Comments while Saving Excel file to Html

When you save your Excel file into HTML, comments are not exported. However, Aspose.Cells provides this feature using the HtmlSaveOptions.IsExportComments property. If you set it true, then HTML will also display comments present in your Excel file.

Disable Downlevel Revealed Comments while saving to HTML

When you save your Excel file to HTML, then Aspose.Cells reveal Downlevel Conditional Comments. These conditional comments are mostly relevant to old versions of Internet Explorer and are irrelevant to modern Web Browsers. You can read about them in detail at this link. Aspose.Cells allows you to eliminate these Downlevel Revealed Comments by setting the HtmlSaveOptions.DisableDownlevelRevealedComments property to true.

The screenshot shows the effect of this property on output Html when it is not set true.

Disable Downlevel Revealed Comments

Add Digital Signature to an already signed Excel file

Aspose.Cells provides the Workbook.addDigitalSignature(DigitalSignatureCollection digitalSignatureCollection) method that you can use to add digital signature to an already signed Excel file.

Please note while adding digital signature to an already signed Excel document, if the original document is Aspose.Cells generated document, it works well. But if the original document is generated by other engines (e.g. Microsoft Excel etc.), Aspose.Cells cannot keep the file same after loading and re-saving it, this will make the original signature to be invalid.

Copy VBA Project having User Form from Template to Target Workbook

Aspose.Cells allows you to copy VBA project from one Excel file into another Excel file. VBA project consists of various types of modules i.e. Document, Procedural, Designer etc. All modules can be copied with simple code but for Designer module, there is some extra data called Designer Storage needs to be accessed or copied. The following two methods deal with Designer Storage.

  • VbaModuleCollection.getDesignerStorage()
  • VbaModuleCollection.addDesignerStorage()

Please see the following article for more detail and sample code.

Send Shape Front or Back inside the Worksheet

When there are multiple shapes present in the same location then how will they be visible is decided by their z-order positions. Aspose.Cells provides Shape.toFrontOrBack() method which changes the z-order position of the shape. If you want to send shape to back you will use negative number like -1, -2, -3 etc. and if you want to send shape to front, you will use positive number like 1, 2, 3 etc.

This screenshot shows the effect of the code in the above article on the source workbook. As you can see, the z-order positions of shapes have been changed as per sample code.

Sort Data in Column with Custom Sort List

You can sort data in the column using custom list. This can be done using DataSorter.addKey(int key, SortOrder order, String customList) method. However, this method works only if the items in custom list do not have commas inside them. If they have commas like “USA,US”, “China,CN” etc., then you must use DataSorter.addKey(int key, SortOrder order, String[] customList) method. Here, the last parameter is not String but Array of Strings.

//Load the source Excel file
Workbook wb = new Workbook(dirPath + "sampleSortData_CustomSortList.xlsx");
  
//Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);
  
//Specify cell area - sort from A1 to A40
CellArea ca = CellArea.createCellArea("A1", "A40");
  
//Create Custom Sort list
String[] customSortList = new String[] { "USA,US", "Brazil,BR", "China,CN", "Russia,RU", "Canada,CA" };
  
//Add Key for Column A, Sort it in Ascending Order with Custom Sort List
wb.getDataSorter().addKey(0, SortOrder.ASCENDING, customSortList);
wb.getDataSorter().sort(ws.getCells(), ca);
  
//Save the output Excel file
wb.save(dirPath + "outputSortData_CustomSortList.xlsx");

Add PDF Bookmarks with Named Destinations

Named Destinations are special kinds of bookmarks or links in PDF that do not depend on PDF pages. It means, if pages are added or deleted from PDF, bookmarks may become invalid but named destinations will remain intact. To create Named Destination, please use the PdfBookmarkEntry.setDestinationName() method.

Control loading of External Resources in MS Excel Workbook while rendering to PDF

Your Excel file may contain external resources e.g. linked images or objects. When you convert your Excel file to Pdf, Aspose.Cells retrieves these external resources and renders them to Pdf. But sometimes, you do not want to load these external resources and more than that, you want to manipulate them. You can do this using PdfSaveOptions.StreamProvider which implements the IStreamProvider interface.

Aspose.Cells for Android via Java Resources

The resources, you may need to accomplish your tasks:


To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply