-
Notifications
You must be signed in to change notification settings - Fork 268
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
File exported is corrupt. #16
Comments
I had the same message error "This file is corrupt!" and I solved with:
I had the problem of the unknown characters (japanese) importing a CSV to the Excel, but not with this library. |
The solution that solved corrupt files for me was not to use the
but as soon as I add date type column, Excel complains about file is corrupt:
|
Excel stores date in OA format. Check out the example in using excel-export. You need to do a conversion in beforeCellWrite beforeCellWrite:function(){ var originDate = new On May 5, 2015 3:38 PM, "Mitchell Simoens" [email protected] wrote:
|
What junk. Why does it take care of that for you? It knows the type is date... So if the value is a Date object, take care of that. I also had an issue that I was passing in an int when the column had string specified. Little bit of type checking would go a long way... Planning on developing my own now. Started to patch a few things and am gonna give up. I'll do my own and maintain it internally. |
Same problem here with a simple file (one column of type string), with no special characters. I tried this solution (http://answers.microsoft.com/en-us/office/forum/office_2010-excel/the-file-is-corrupt-and-cannot-be-opened-error-on/93af59c1-946c-4f5f-83c1-bd6f58dbd94f?auth=1), but it doesn't work... So I guess it comes from the generation. Any help? |
I export the data from MongoDB. Then I use "excel-export" to export the .xlsx file.
And I have found that some issues due to corrupt the excel file and display nothing.
Such as
-1 Some emoji characters can't not display and the excel alert "This file is corrupt!".
-2 Some unknown characters shown as '口'.
Due to these cases, I have tried this:
var temp = source.replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g, '');
var buf = iconv.encode(temp, 'UTF8');//return GBK encoded bytes from unicode string
var str = iconv.decode(buf, 'UTF8'); //return unicode string from GBK encoded bytes
return str;
Besides this, I also tried other methods.
But they have not solved this issue perfectly.
The text was updated successfully, but these errors were encountered: