We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Upgrade error


We are using Aspose.Cells( I am trying to upgrade to Aspose.Cells( I got lot of errors like Error 520 Warning as Error: ‘Aspose.Cells.Workbook.Save(string, Aspose.Cells.FileFormatType)’ is obsolete: 'Use Workbook.Save(string,SaveFormat) method instead.

workBook.Save(filePath, FileFormatType.Default); this is the code i use, shall i use workBook.Save(filePath, SaveFormat.Auto); instead?

‘Aspose.Cells.Cell’ does not contain a definition for ‘Style’ and no extension method ‘Style’ accepting a first argument of type ‘Aspose.Cells.Cell’ could be found (are you missing a using directive or an assembly reference?)


Hi Kavi,

Thanks for your posting and using Aspose.Cells.

Yes, please use workBook.Save(filePath, SaveFormat.Auto) now.

For Style, please use Cell.GetStyle() and Cell.SetStyle() methods now.

Please let us know on which type of code you are getting this error (‘Aspose.Cells.Cell’ does not contain a definition for ‘Style’) so that we could guide you better.


WorkSheet.Cells[“A1”].Style.Font.IsBold = true; This is the code i used for style.


Using the newer versions, you will use the following lines to make the cell text bold.
Sample code:

Style style = WorkSheet.Cells[“A1”].GetStyle();
style.Font.IsBold = true;

For your information, while trying to keep the API as straightforward and clear as possible, we decided to recognize and honor the common development practices of the platform. Therefore, Aspose.Cells for .NET follows coding guidelines widely accepted by .NET developers. With the release of Aspose.Cells for .NET version v5.0.0, we have re-organized the API classes for Aspose.Cells component. This change has some major aspects that we follow. We have added new namespaces. All the API (classes, interfaces, enumerations, structures etc.) were previously located in the Aspose.Cells namespace. Now, certain sets of API have been moved to their relative namespaces, which make the relationship of classes (with their members) and namespaces clear and simplified.

Let me come towards your significant errors that you might encounter while upgrading to new versions of the product, so you can fix them accordingly:
1) You need to import the relevant namesapaces to your demo pages or use fully qualified naming when declaring objects for classes etc.:
using System;
using System.Web;
using Aspose.Cells;
using Aspose.Cells.Pivot;
2) Some classes are renamed especially collection classes. e.g
i) Validations --> ValidationCollection
ii) PivotTable --> PivotTableCollection
3) Aspose.Cells.Style property is eliminated/obsoleted now, you should adjust your code to use Aspose.Cells.GetStyle() and Aspose.Cells.SetStyle() methods/ approach, it will also enhance the performance to certain extent:
Your sample code using Style attribute should be updated accordingly, e.g
Style style = wsNdaa.Cells[0, 0].GetStyle();
style.Font.IsBold = true;
wsNdaa.Cells[0, 0].SetStyle(style);
Styyle style2 = cells[“I1”].GetStyle();
style2.HorizontalAlignment = TextAlignmentType.Center;
style2.BackgroundColor = System.Drawing.Color.Navy;
style2.Font.IsBold = true;
We recommend you to kindly see the Aspose.Cells for .NET Wiki Conf. Docs for your reference, especially the topics:

Hope, this helps a bit.

Thank you.