Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 14:44

Hi,

Has something changed in the last few updates regarding exporting localisation excel sheets? My game was running fine but today I'm getting an error trying to read the excel sheets in C#. The ExcelReaderFactory is throwing an error reading the excel sheet "Wrong Central Directory signature".

Google hasn't been helpful but all signs point to the exporter.

Any ideas? My game won't run while this issue is happening :(
RisingSun
 
Posts: 38
Joined: Mon 17. Apr 2017, 19:12

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 14:50

I should add, this is using the Json exporter with the localisations excel checkbox ticked
RisingSun
 
Posts: 38
Joined: Mon 17. Apr 2017, 19:12

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 15:09

Hi RisingSun,

just to be sure: You are exporting from articy:draft using our JSON (Not unity) export with localization enabled. Is the error part in our export or after you tried to use the generated excel inside your C# code?
What are you using to read the excel files?

Has something changed in the last few updates regarding exporting localisation excel sheets?


Yes, some cells where automatically changed when ClosedXML tried to interpret text as a different type, for example a Date could be stored as a string, causing problems when you expected the string not a formatted date string. That was changed to always store any string as an actual string, without any built in conversion.That should be the only big change if i'm not mistaken.

The error you are mentioning sounds like a problem in the zip reading part of the excel.
Depending on the answer to my first question: What are you using to read the excels and/or can you send me one of those affected excel files to nico.probst(at)nevigo.com, so i can have a look.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 15:24

Hi Nico,

I am exporting from articy:draft using your JSON exporter with localization enabled. The error occurs when I try reading the exported xlsx in a C# application. I can open the spreadsheets with OpenOffice and it all looks correct, but I cannot load it inside my application.

This is the code I'm using in a standard C# .NET application, which was working previously until I exported an updated articy:draft project today. The Excel reading is done via a third-party library here https://github.com/ExcelDataReader/ExcelDataReader which hasn't had this issue reported to the github project, so I don't think the problem lies there, but with the exported file.

Code: Select all
var file = Path.Combine("Game", string.Format("loc_{0}_en", packageName));
            var data = ServiceLocator.GetTemporaryContentManager().Load<ByteData>(file);
            Stream stream = new MemoryStream(data.Data);
            IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            excelReader.IsFirstRowAsColumnNames = true;

            DataSet result = excelReader.AsDataSet(); // This fails to read, inspecting excelReader shows the error as "Wrong Central Directory signature"
            var table = result.Tables[0]; // result is null when error happens on line above.


I'll send a copy of the exported spreadsheet to the email address you supplied.

Thanks for your help
RisingSun
 
Posts: 38
Joined: Mon 17. Apr 2017, 19:12

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 15:49

Hi RisingSun,

while i never worked with ExcelDataReader before, i setup a very quick console application in VS2017 to test the parsing using the file you have send me.
I used nuGet to install ExcelDataReader v2.1.2.3. I just copied from one of their test cases and built this:

Code: Select all
using (var stream = File.Open("loc_Core_en.xlsx", FileMode.Open, FileAccess.Read))
{
   using (var reader = ExcelReaderFactory.CreateOpenXmlReader(stream))
   {
      reader.IsFirstRowAsColumnNames = true;
      var result = reader.AsDataSet();
      var table = result.Tables[0];

      Console.WriteLine(table.Rows[0][0]);
   }
}


This testcase is working fine and its parsing the excel as expected.
What also might have happened is, that you changed the ICShapCode.SharpZipLip assembly, which is used to parse excel files.
If you use nuget you might want to try to update the existing files.

Hope that helps you

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 16:20

Hi thanks, I'll make sure my nuget package is up to date and try it in another app outside of my game. Sorry for false alarm! :)
RisingSun
 
Posts: 38
Joined: Mon 17. Apr 2017, 19:12

Re: Localisation excel "Wrong Central Directory signature"

Mon 10. Jul 2017, 17:02

Turns out it was a bug in my code where I was creating a copy of the xlsx file by writing the byte[] back into a new file. Loading the copy was still throwing the error but I've changed it up to read the original and works, so now I know where the problem lies!

Thanks anyway for helping me get to the bottom of it :)
RisingSun
 
Posts: 38
Joined: Mon 17. Apr 2017, 19:12

Re: Localisation excel "Wrong Central Directory signature"

Tue 11. Jul 2017, 08:45

Don't mention it, glad i could help. :)

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

Who We Are
Contact Us
Social Links