This project has moved and is read-only. For the latest updates, please go here.

Problem generating Excel

Feb 10, 2010 at 10:57 AM
Edited Feb 10, 2010 at 10:58 AM

What happens is that i cannot open excel with other code readers until i open and save the excel again.

The file increases few KB after save it with excel and everything works fine, so i thing must be a problem.

I used ExcelPackage Project DLL and the excel works fine but i need to generate files without saving on disk.

Feb 10, 2010 at 11:08 AM
Edited Feb 10, 2010 at 12:27 PM

Try to open the file with a text processor like notepad++, if u see any html code inside your generate excel file....try to save it with code below:


                    Response.AddHeader("content-disposition", "attachment;  filename=file.xlsx");
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";                    
Feb 10, 2010 at 11:44 AM

Not working.

My previous code was similar but i had  at the end.




I opened the file with notepad++ and i don't have html inside, so it outputs well.

For example, the excel file i generate have 68KB, when i open with MS Excel 2007 and just click on save button it increases to 71KB.

After save with excel i can import correctly the excel file generated to my application.



Feb 10, 2010 at 12:17 PM

When u open with excel, did u see any warning about recover or something like that?

Feb 10, 2010 at 12:20 PM

No warning. 

Feb 10, 2010 at 1:04 PM

I was testing and i can read excel with oledb, so perhaps there is no problem.

But it's strange that i only can import files ( i am using  that are saved in MS Excel 2007 or original ExcelPackage, with epplus are failing.

Thanks for helping.

Feb 10, 2010 at 1:56 PM

I had a quick look at it and exceldatareader reads the dimension-tag from sheet xml files inside the package.  (looks somthing like this... <dimension ref="A1:U85"/>)

I don't update it since Excel figure out the dimensions without this tag, but I guess I should add it to a future release.