Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read XLS file (file is corrupted) #164

Open
GoogleCodeExporter opened this issue Sep 11, 2015 · 1 comment
Open

Unable to read XLS file (file is corrupted) #164

GoogleCodeExporter opened this issue Sep 11, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Try this code 

SerializationObject.Module mod = 
XMLSerializer<SerializationObject.Module>.Deserialize("XLS_Config.XML");
            foreach (SerializationObject.Client cli in mod.clients)
            {
                String path = cli.path + cli.file_name;
                Console.WriteLine("\npath : " + cli.path + " file_name : " + cli.file_name); 
                XL.SpreadSheet.Workbook wbk = new XL.SpreadSheet.Workbook();
                foreach (SerializationObject.Sheet sh in cli.sheets)
                {
                    XL.SpreadSheet.Worksheet wbsh = new XL.SpreadSheet.Worksheet(sh.name);
                    Console.WriteLine("\nsheet_name : " + sh.name);
                    int i = 0;
                    foreach (SerializationObject.Column col in sh.columns)
                    {

                        wbsh.Cells[i, 0] = new XL.SpreadSheet.Cell(col.name);
                        Console.WriteLine("\ncol_name " + i + " : " + col.name); 
                        i++;
                        for (int cmp = 0; cmp < 100; cmp++)
                            wbsh.Cells[cmp, 0] = new XL.SpreadSheet.Cell("");
                    }
                }
                wbk.Save(path);
            }
            Console.Read();

Don't worry, I use a configuration XML file and its OK. I see this error before 
in this website but the solution doesn't works. 

What is the expected output? What do you see instead?

Excel encounter unreadable content, Do you want to recover this content ?

I clicked on Yes and, Unable to read this file, This workbook is corrupted.

What version of the product are you using? On what operating system?

I program with VS 2010, I have Excel 2007, I have Windows Seven (x64), I use 
the ExcelLibrary_20110414. 

Please provide any additional information below.

Can you answer me quickly please ? my deadline is soon.
Sorry for my bad English, I'm french.

Original issue reported on code.google.com by [email protected] on 18 Mar 2014 at 10:01

Attachments:

@GoogleCodeExporter
Copy link
Author

the problem you are facing has to do with the fact that because the file is too 
small, it appears corrupted. Try adding a few blank cells in order to make the 
file larger. When I say blank cells I mean strings with nothing in them...empty 
strings. I noticed that the files need to be larger than 7.0 KB. I hope this 
helps

Original comment by [email protected] on 25 Jun 2014 at 8:51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant