Add Bookmarks with Named Destination and Control loading of External Resources in PDF using Aspose.Cells for .NET 17.9

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


Aspose.Cells for .NET logo
We are pleased to announce the release of Aspose.Cells for .NET v17.9. This release includes a some valuable features and other enhancements along with critical bug fixes that further improve the overall stability of the APIs. Please check the release notes in order to get an idea about what is new and what has been enhanced or fixed with this revision of Aspose.Cells for .NET. You can also install Aspose for .NET APIs directly from NuGet repository.

Add PDF Bookmarks with Named Destinations

Aspose.Cells supports to specify Named Destinations in the output PDF file 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 set the PdfBookmarkEntry.DestinationName property.

//Load source Excel file
Workbook wb = new Workbook("Book1.xlsx");
 
//Access first worksheet
Worksheet ws = wb.Worksheets[0];
 
//Access cell C5
Cell cell = ws.Cells["C5"];
 
//Create Bookmark and Destination for this cell
PdfBookmarkEntry bookmarkEntry = new PdfBookmarkEntry();
bookmarkEntry.Text = "Text";
bookmarkEntry.Destination = cell;
bookmarkEntry.DestinationName = "AsposeCells--" + cell.Name;
 
//Access cell G56
cell = ws.Cells["G56"];
 
//Create Sub-Bookmark and Destination for this cell
PdfBookmarkEntry subbookmarkEntry1 = new PdfBookmarkEntry();
subbookmarkEntry1.Text = "Text1";
subbookmarkEntry1.Destination = cell;
subbookmarkEntry1.DestinationName = "AsposeCells--" + cell.Name;
 
//Access cell L4
cell = ws.Cells["L4"];
 
//Create Sub-Bookmark and Destination for this cell
PdfBookmarkEntry subbookmarkEntry2 = new PdfBookmarkEntry();
subbookmarkEntry2.Text = "Text2";
subbookmarkEntry2.Destination = cell;
subbookmarkEntry2.DestinationName = "AsposeCells--" + cell.Name;
 
//Add Sub-Bookmarks in list
ArrayList list = new ArrayList();
list.Add(subbookmarkEntry1);
list.Add(subbookmarkEntry2);
 
//Assign Sub-Bookmarks list to Bookmark Sub-Entry
bookmarkEntry.SubEntry = list;
 
//Create PdfSaveOptions and assign Bookmark to it
PdfSaveOptions opts = new PdfSaveOptions();
opts.Bookmark = bookmarkEntry;
 
//Save the workbook in Pdf format with given pdf save options
wb.Save("out1.pdf", opts);

Please see the document/article (with attachments) that explains on how to add PDF Bookmarks with Named Destinations for your complete reference.

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

If your Excel file contains external resources(linked images or objects), so, when you convert your Excel file to Pdf, Aspose.Cells retrieves these external resources and renders them to Pdf file format. Now, if you do not want to load these external resources rather you want to manipulate them, you can do this using PdfSaveOptions.StreamProvider API which implements the IStreamProvider interface. For more detail, please see this article.

Copy VBA Macro UserForm DesignerStorage from Template to Target Workbook

Aspose.Cells allows you to copy VBA project from one Excel file into other. 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. For more detail, please see this article.

Send Shape Front or Back inside the Worksheet

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. For more detail, please see this article.

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. For more detail, please see this article.

Create Remove and Get GridCell Comments

 GridWeb displays comments as Tooltips like MS-Excel does when you hover mouse over the respective cell. The web based grid control provided by Aspose.Cells for .NET allows you to create, remove and get cell comments inside the worksheet. For more detail, please see this article.

Other Enhancements and Fixes

There are some other enhancements included in the new release for the users. A few of the worth mentioning features/enhancements are as follow.

  • Determine which stack size is needed for a certain Workbook.
  • Exception: “Too many entries. Consider setting ZipOutputStream.Enable Zip64” on merging the file(s).
  • When RecommendReadOnly is true, IsWriteProtected is also true.
  • Handled NullReferenceException when reading XLSX using LoadFilter containing Pivot Table.
  • Handled “Input string was not in a correct format” exception on opening MS Excel file.

Aspose.Cells 17.9 has enhanced its core for more stability as well as fixed many critical bugs. In this release, we have fixed several other issues. For example, issues around reading/writing MS Excel file formats, Smart Markers, manipulating ranges, inserting rows and columns, rendering shapes and drawing objects, manipulating OLE Objects, rendering and manipulating charts, manipulating PivotTables, rendering images from Excel worksheets, rendering images files from charts and exporting Excel workbooks to PDF format have been resolved.

Changes to the Public API

This version of Aspose.Cells for .NET has made some changes to the Public API. A few of the worth mentioning changes are as follow:

  • Added LoadStyleStrategy property, it indicates the strategy to apply style for parsed values when converting string value to number or DateTime.
  • Added class AbstractCalculationMonitor, it provides APIs for users to monitor the progress of formula calculations.
  • Added CalculationMonitor property, it allows user to provide custom implementation to monitor the progress of formula calculation.
  • Added DestinationName property, it gets or sets name of destination. If destination name is set, the destination will be defined as a named destination with this name.
  • Added AddKey() method, it adds sorted column index and sort order with custom sort list.
  • Added ToFrontOrBack() method, it brings the shape to front or sends it to the back.
  • Added StreamProvider property and ResourceLoadingType enum, it gets and sets the type of loading external resource.
  • Added VbaModuleCollection.AddDesignerStorage() and GetDesignerStorage() methods, it gets and sets the designer storage of the VBA project.

Aspose.Cells for .NET 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