Error message after opening Excel file generated by an application

Asked

Viewed 809 times

1

I have an application that reads a file xml, takes the data and passes to a file in the format xls. But when I open the file that was Erardo appears the following message:

inserir a descrição da imagem aqui

Would someone explain to me the cause of this mistake?

  • Can you post the code? Without it it is difficult to help

  • The code is a little "Giant". But I think I managed to solve, I saw something about changing to xlsx format. I will do some more tests

  • If it’s too big, I recommend putting it in the bin and pass the link. If you get the solution be sure to put the answer. =)

  • I’ll put it in the Stebin.

  • Reporting class: http://pastebin.com/NDmQ4LHs

  • Method: http://pastebin.com/HwzPamj4

  • I looked here at the documentation that the Xssfworkbook class generates file. xlsx and Hssfworkbook generates .xls. file Changes the ai extension in your code to see if it works.

Show 2 more comments

1 answer

5


The POI is divided into libraries H and X.

Libraries H (HSSF, HWPF, HSLF) produce documents in format .doc, .xls and .ppt, as libraries X (XSSF, XWPF, XSLF) produce the formats .docx, .xlsx and .pptx.

Since Voce is using XSSF, change the file extension saved to .xlsx solves the problem.

  • If I want xls I have to search the H libraries?

  • Correct. The two libraries are very similar, but X (newer) has more features. Do you really need to produce . xls? The format. xlsx is already 8 years old.

  • Yes, because some clients still use old versions of office :/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.