Articy Forum


https://www.articy.com:443/forum/

Localisation excel "Wrong Central Directory signature"

https://www.articy.com:443/forum/viewtopic.php?f=33&t=18235

Page 1 of 1

Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 14:44
by RisingSun
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 :(

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 14:50
by RisingSun
I should add, this is using the Json exporter with the localisations excel checkbox ticked

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 15:09
by [Articy] Nico Probst
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

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 15:24
by RisingSun
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

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 15:49
by [Articy] Nico Probst
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

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 16:20
by RisingSun
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! :)

Re: Localisation excel "Wrong Central Directory signature"

Posted: Mon 10. Jul 2017, 17:02
by RisingSun
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 :)

Re: Localisation excel "Wrong Central Directory signature"

Posted: Tue 11. Jul 2017, 08:45
by [Articy] Nico Probst
Don't mention it, glad i could help. :)

Best regards

Nico

All times are UTC
Page 1 of 1