Downloading Excel file xlsx in Angularjs and WebApi

后端 未结 5 796
离开以前
离开以前 2021-01-31 11:52


I am working on a task, in which I have to download a report in xlsx format. The report file is generated successfully from server, and is received on client side as well.

5条回答
  •  逝去的感伤
    2021-01-31 12:19

    I encountered a similar problem when writing excel using Javascript library Excel Builder. At the end, I found the reason was that a control character '\u001a' was included in data.

    The solution is to encode the control char in Excel's way as '_x001a_'.

    The way I diagnosed the problem was like this:

    .xlsx file is just a zipped xml file. You can open it with 7-zip. Inside the xl/ folder there is a file sharedString.xml containing all strings. Extract the file and open it with Notepad++. If you see any control character, then it might be the cause.

提交回复
热议问题