Migration Issue from Aspose.Cells (ver. 8.4.2.0) to Aspose.Total (ver. 19.12.0)

Issue is when we manipulate excel (.xlsx) file in memory stream using OpenXML (ver 2.0), the Aspose.Cells license (ver. 8.4.2.0) understands and supports the manipulated memory stream.

However, when we manipulate excel (.xlsx) file in memory stream using OpenXML (ver 2.0), the Aspose.Total license (ver. 19.12.0), it doesn’t understand nor support the manipulated memory stream and keeps giving an error: "This file’s format is not supported or you don’t specify a correct format."

Workarounds already tried:

  • defining .Xlsx as Aspose LoadOptions Format
  • upgrading Document.Format.Openxml version from 2.0 to 2.9

Question:
In above-mentioned issue, what went wrong in Aspose.Cells and Aspose.Total versions that openxml manipulated memory stream is supported by Aspose.Cells (ver. 8.4.2.0) and not supported in (ver. 19.12.0) ?

Thanks

@porbistech,

Thanks for the details.

Could you create two solutions (stand alone console applications), one with v8.4.2.0 and other with v19.12 to show the issue, we will check it soon. You may also attach template Excel files (if any).

PS. please zip the project(s) and files prior attaching.

Thanks for the response.

However, we’ve found the solution to the mentioned problem and would like to share it with the public.

Solution:
Whenever we’re referencing Aspose.Cells.Workbook or any other Aspose utility and passing manipulated memory stream as a parameter, then just reset the position of memory stream before passing it as a parameter.

In code style; just add below line above workbook object declaration.

streamExcelFile.Position = 0;
Aspose.Cells.Workbook sourceExcel = new Aspose.Cells.Workbook(streamExcelFile);

Hope this helps others.
Thanks

@porbistech,

Good to know that you have sorted out your issue now. And, yes, when you get the file into streams it is always better to set the pointer at the beginning before loading the file streams into Workbook object. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.