Compatibility of Aspose.Cells with earlier Aspose.Excel

Hi All,

I am working on a support project where the project has been transitioned from one organization to our organization. The organization which developed the project and supported the application for couple of years used Aspose.Excel.

Now as Aspose.Excel has been out of the market our organization procured Aspose.Cells. When we brought it the vendor mentioned that the tool is backward compatible i.e. the same code which worked for Aspose.Excel can work for Aspose.Cell with little or no modifications.

However, when I delete the refrence for Aspose.Excel (from the existing code) and add the new refrence of Aspose.Cell, it gives me the following error

The type or namespace name 'Excel' does not exist in the namespace 'Aspose' (are you missing an assembly reference?)

The error occurs for the following statements:

  • 1) Aspose.Excel.License AsposeLicense
  • 2) private static Aspose.Excel.License asposeLicense;
  • 3) using Aspose.Excel;

The language is C# and I am using .net Framework 2.0.

Are we supposed to replace the Excel Aspose.Excel namespace with Aspose.Cells?

Are there any methods which were in Aspose.Excel and which are not supported by Aspose.Cells?

Thanks and Regards

Sushant Joshi

Hi,

Yes, Aspose.Excel is renamed to become Aspose.Cells now. Aspose.Excel.Excel class is replaced by Aspose.Cells.Workbook.

Please check the following document for your reference:

https://downloads.aspose.com/cells/net

Thank you.

Hi,

Thanks for the prompt response. However as the article mentioned I performed following things:

1) Replace Aspose.Excel dll with Aspose.Cells dll

2) Replace the license files

3) Made following other code changes:

a. Excel class is replaced by Workbook class.

b. ExcelDesigner class is replaced by WorkbookDesigner class.

c. ExcelHelper class is replaced by CellsHelper class.

As per the article the earlier existing code would change to:

(original)

Cell cell = excel.Worksheets[0].Cells[row, column];

cell.PutValue(text);

excel.Worksheets[0].AutoFitColumn(column);

excel.Worksheets[0].Cells.Columns[column].Style.Number = 0;

excel.Worksheets[0].Cells.Columns[column].Style.IsTextWrapped = true;

(After Modification)

Cell cell = Workbook.Worksheets[0].Cells[row, column];

cell.PutValue(text);

Workbook.Worksheets[0].AutoFitColumn(column);

Workbook.Worksheets[0].Cells.Columns[column].Style.Number = 0;

Workbook.Worksheets[0].Cells.Columns[column].Style.IsTextWrapped = true;

However, when I made that change, it gave me error

An object reference is required for the nonstatic field, method, or property 'Aspose.Cells.Workbook.Worksheets.get'

When I replaced it with Aspose.Cells in place of excel, I get an error

'Aspose.Cells.Worksheets' is a 'type', which is not valid in the given context

I request you to kindly let me know as to what exactly would be a appropriate replace for the code snippet. Also do let me know if we have any tools to convert the code which was for earlier Aspose.Excel to Aspose.Cells

Thanks & Regards,

Sushant Joshi.

Hi,

I think you need to instantiate the Workbook object.

e.g..,

//............

Workbook workbook = new Workbook();

//If you are opening an existing excel file use this line otherwise comment it.

workbook.Open(filePath); //where filePath contains the excel file name with path.

//.......................

Cell cell = workbook.Worksheets[0].Cells[row, column];

cell.PutValue(text);

workbook.Worksheets[0].AutoFitColumn(column);

workbook.Worksheets[0].Cells.Columns[column].Style.Number = 0;

workbook.Worksheets[0].Cells.Columns[column].Style.IsTextWrapped = true;

//.........................

Thank you.

Hi,

Thanks again. It worked.

Regards,

Sushant Joshi.