Error opening ODS file

First of all, the correct version (18.2.2) is displayed. I built you a demo, with the file and without the Cells Assembly.

Sample
BugDemo.zip (11.4 KB)

Thanks for checking it out.

Same error with version 18.2.4.

@mservdev,

Thanks for the sample project with template file.

This time I am able to reproduce the issue using your template file, may be I used the right ODS file now. Anyways, I have logged a ticket with an id “CELLSNET-45950” for your issue. The ticket is logged as following:

  • CELLSNET-45950 - Exception “ReadElementString only could be called when the content is simple or empty” when loading an ODS file

Once we have an update on it, we will let you know here.

1 Like

@mservdev

Thanks for using Aspose.Cells.

Please download and try the following fix and let us know your feedback.

@shakeel.faiz
It works, thank you very much! There’s one thing that struck me. If you are reading my sample file, please pay attention to A13-B13.

A13
Formula: =SU
Display value in Excel: #NAME?
DisplayStringValue in Cells: 0

B13
Formula: C18:C19
Display value in Excel: #VALUE!
DisplayStringValue in Cells: 00. Dez

Maybe this is just a characteristic of ODS?

@mservdev,

Good to know that your issue is resolved by the new fix/version.

Please call Workbook.CalculateFormula() method before reading the values from the cells:
e.g
Sample code:

Workbook book = new Workbook(“e:\test2\ErrorOpening.ods”); //Cells Version 18.2.0
book.CalculateFormula();
Worksheet worksheet = book.Worksheets[0];
Cells cells = worksheet.Cells;
Cell cell1 = cells[“A13”];
Cell cell2 = cells[“B13”];

Let us know if you still find the issue.

1 Like

Thanks, that was the solution :slight_smile:

@mservdev,

Good to know that the suggested line of code figures out your issue now. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Hi,

I’m having the same error in the Java version of Aspose Cells, version 18.2.0. I have attached the file to this post. Is there a fix for this?

Cheers.

ods.zip (9.5 KB)

@simon.wiseman,

Thanks for the sample ODS file.

I think you are using Aspose.Cells for Java APIs. I am able to reproduce the issue using your template file to be loaded by Aspose.Cells for Java Workbook object. I have logged a ticket with an id “CELLSJAVA-42545” for your issue. The ticket is logged as following:

CELLSJAVA-42545 - Exception “ReadElementString only could be called when the content is simple or empty” when loading an ODS file by Aspose.Cells for Java.
e.g
Sample code:

Workbook book = new Workbook("e:\\test2\\ods.ods");

Once we have an update on it, we will let you know here.

@simon.wiseman

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSJAVA-42545 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@shakeel.faiz

I found another bug in my ODS file example. When you open the file in Excel, cell C3 has the following text: 8:15:00 PM and value: 12.05.2028 20:15:00

But Cells gives me the following text: 8:13:08 PM and value: 12.05.2028 20:13:07

Could you please take a look at this?

@mservdev,

I did try your scenario/case using your file with our latest version/fix (Aspose.Cells for .NET v18.2.6) and I do not get this issue on my end, see the screenshot for your reference:

I have downloaded 18.2.6 but still got the same problem. I have attached you my sample (7.7 KB) that got problems.

@mservdev,

Thanks for the screenshot and sample file.

That is strange as I do not get this issue with your new file and sample code (in the screenshot I shared in my previous post). What is your locale/regional settings set on the machine, could you provide details for your OS/environment where you are executing the task. My environment is: OS: Windows 8, regional/local settings: English (Singapore ), etc.

@Amjad_Sahi

OS: Windows 10
Region/local: German (Germany)

Or do you need more specific information?

@mservdev,

I did change the regional settings or my pc and try the sample code, it works fine and still I do not get this issue, see the screenshot for your reference:

Please make sure that you are using latest version/fix: Aspose.Cells for .NET v18.2.6 (link is already shared in one of our previous posts), you may even print the version number at the start before using the original code if you are using the correct version.
e.g
Sample code:

Console.WriteLine(CellsHelper.GetVersion());

@Amjad_Sahi

I think I found the problem :slight_smile:

I use the 18.2.6 version. The problem is, I have a NUnit test for my specific test and the result from Cells is “12.05.2028 20:13:07” also with your LoadOptions data. But if I create a normal Console application, the date is “12.05.2028 20:15:00”.

I suspect that the NUnit test will somehow affect the Cells result.

I’ll give you an example in a few minutes.

I have now set up an example project for you. The problem is, I can debug the NUnit test directly through Visual Studio / ReSharper. If you can’t do that, here’s an article on how to do it without it.

NUnitDate.zip (14.9 KB)

@mservdev,

Thanks for the sample project.

I did try simple Unit Test in VS.NET using the following sample code and it passes the test with your ODS file:
e.g
Sample code:

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Aspose.Cells;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            Workbook workbook = new Workbook("E:\\test2\\error opening ods\\WrongDateTime.ods");
            workbook.CalculateFormula();

            var cell = workbook.Worksheets[0].Cells["C3"];

            Assert.AreEqual("8:15:00 PM", cell.DisplayStringValue);
        }
    }
}

However, I did not try NUnit test it yet as we got to first install Visual Studio Express Edition. We will try to do that soon.