Control External Resources Embedded in Excel Spreadsheets using C# .NET

Aspose.Cells for .NET logo

We are pleased to announce the release of Aspose.Cells for .NET v18.2. Please check the document on how to install Aspose for .NET APIs directly from NuGet repository. In this release, we have added a few valuable features for the users. For example, we included support to control/manage external resources embedded in the Excel document. You can filter formulas and defined names separately when loading Excel spreadsheets. Some other enhancements are also added regarding shapes. 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.

Control External Resources in Spreadsheet in C#

If your Excel file contains external resources e.g. linked images etc. and you need to control these external resources, Aspose.Cells supports to manage external resources using Workbook.Settings.StreamProvider which takes the implementation of IStreamProvider interface. Whenever you will try to render your worksheet containing external resources, the methods of IStreamProvider interface will be invoked which will enable you to take appropriate actions for your external resources. The following snippet loads an Excel file (containing a linked image). The code replaces the linked image with Aspose Logo and renders the entire sheet into a single image using SheetRender class.

Please see the document/article with attachment(s) on how to control external resources embedded in an Excel worksheet for your reference.

Filter Defined Names while loading Workbook

Aspose.Cells now allows you to filter/exclude defined names present inside the workbook while loading the spreadsheet. You may use LoadDataFilterOptions.DefinedNames to load defined names and use ~LoadDataFilterOptions.DefinedNames to remove them while loading the workbook. For more detail on the feature, please see this article/document for your reference.

Set Margins of Comment or Shape inside the Worksheet

Using Aspose.Cells APIs, you can set the margins of any shape including comments using the Shape.TextBody.TextAlignment property. This property returns the object of Aspose.Cells.Drawing.Texts.ShapeTextAlignment class which has different properties e.g. TopMarginPt, LeftMarginPt, BottomMarginPt, RightMarginPt etc. that can be used to set the top, left, bottom and right margins. For more detail, please see this article.

Specify Formula Fields while Importing Data to Worksheet

You can specify formula fields when you import data into your worksheet using the ImportTableOptions.IsFormulas. This property takes the Boolean array where the value true means the field is a formula field. For example, if the third field is a formula field, then third value in the array will be true. For more detail, please see this article.

Specify Maximum Rows of Shared Formula

Aspose.Cells provides the Workbook.Settings.MaxRowsOfSharedFormula property that can be used to specify the maximum rows of the shared formula. The shared formula will be split into several shared formulas if the total rows of the shared formula are greater than it. For more detail, please see this article.

Other Enhancements and Fixes

There are some other enhancements included and a few exceptions handled in the new release for the users. A few of the worth mentioning features and other enhancements are as follows.

  • Implemented Aspose.Cells for .NET Standard and Aspose.Cells for .NET Core.
  • And enhancement is made:=cmd|' /c calc'!A0is not present inside Worksheets.ExternalLinks.
  • Mimic behavior of MS Excel when entering text (while wrapping text is enabled) into Aspose.Cells.GridWeb.
  • Handled an exception “Input string was not in a correct format” when importing the Excel file into Aspose.Cells.GridWeb.

In Aspose.Cells 18.2, we fixed several important bugs and other issues. For example, issues around reading/writing MS Excel file formats, rendering Excel to HTML and vice versa, manipulating shapes, Smart Markers, using PageSetup options, rendering and manipulating charts, manipulating PivotTables, rendering images from Excel worksheetsrendering images files from charts and exporting Excel workbooks to PDF format have been resolved. Moreover, the Aspose.Cells formula calculation engine is further optimized.

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 LoadDataFilterOptions.DefinedNames enum member, it indicates whether loading defined Name objects when loading template file.
  • Added SheetType.Dialog enum member, it represents dialog sheet.
  • Added WorkbookSettings.MaxRowsOfSharedFormula property, it gets and sets the max row number of shared formula. The shared formula will be split to several shared formula if the total rows of shared formula is greater than it.
  • Added ImportTableOptions.IsFormulas property, it represents which column in the datatable should be imported as formulas.

Aspose.Cells for .NET Resources

The resources, you may need to accomplish your tasks: