Closed dablelv closed 5 months ago
@dablelv hi! This is quite a common error pattern, it usually means that some XML in the file is compliant with the standard, but not structured exactly as Excel would do it. The best debugging information you could give me is to save two versions of the generated file - one before and after it has been recovered. Comparing the XML in the xlsx files would give us a clue what it is that Excel doesn't like.
@dablelv hi! This is quite a common error pattern, it usually means that some XML in the file is compliant with the standard, but not structured exactly as Excel would do it. The best debugging information you could give me is to save two versions of the generated file - one before and after it has been recovered. Comparing the XML in the xlsx files would give us a clue what it is that Excel doesn't like.
I found the same issue already commited many years ago. The issue link is https://github.com/tealeg/xlsx/issues/53. There has one before and after it has been recovered excel file. The previous issue has been closed, but the problem remains.
@dablelv - it is unlikely that it's actually the same issue. The symptom is seen for any case where Excel expects the data it receives to follow an exact pattern than is more restrictive than the Office OpenXML standard. The only way for me to know what was wrong is to reproduce the exact case you hit (by having all of the code and the input data) or by having examples of the file before and after Excel has repaired it.
@dablelv - it is unlikely that it's actually the same issue. The symptom is seen for any case where Excel expects the data it receives to follow an exact pattern than is more restrictive than the Office OpenXML standard. The only way for me to know what was wrong is to reproduce the exact case you hit (by having all of the code and the input data) or by having examples of the file before and after Excel has repaired it.
ok, here is the repaired before and after sample files. xlsx_before_repaired.xlsx xlsx_after_repaired.xlsx
I found that the repaired file's size is more than not repaired.
@dablelv thanks! I'll try to take a look in the coming days.
Stale issue message
Stale issue message
Any updates on this issue? I'm running across the same problem, specifically with timestamps. I've tried every cell.Set... function available. They all result in the same outcome. I read through the issue notes and I will do the same as the previous person by providing a before and after "repaired" file for comparison.
@dablelv - I'm sorry, I know this has taken an age to get around to. In the case of your files, I think the route cause is that the font set-up in the file cannot render the text embedded in the spreadsheet. The repair XL seems to have done is to replace the font Arial, with the font "Song Dynasty" (宋体) in the file. I'll have to look a bit deeper to work out a solution.
@jlconrad3 - as I mentioned above. Almost any error in the generated XLSX file would generate this response from excel (it's very difficult to put any two reports together as a single issue. Feel free to provide before and after examples and I'll try to look.
I finally figured out my issue. It was the column width function. Wants I removed that function call, my exports to excel started working. I'm newish to this code base so I can't confirm that it ever worked, but it's been in the code for 3 year so I'm guessing at some point it worked.
sheet.SetColWidth
@jlconrad3 interesting, I'll take a look.
Hi! The same problem for me when updated to new version.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error423080_02.xml</logFileName><summary>Обнаружены ошибки в файле "C:\Users\Andy\Documents\***\test\dislocation (1).xlsx"</summary><removedRecords><removedRecord>Удаленные записи: Сведения о столбцах из части /xl/worksheets/sheet1.xml</removedRecord></removedRecords></recoveryLog>
I finally figured out my issue. It was the column width function. Wants I removed that function call, my exports to excel started working. I'm newish to this code base so I can't confirm that it ever worked, but it's been in the code for 3 year so I'm guessing at some point it worked.
sheet.SetColWidth
I confirm that! If I remove line the SetColWidth, error is diappeared. Ver 3.2.0 is working fine. @tealeg
If only one column with custom width.
I think that numeration of the colums is wrong. I set width to column 2, but actualy setted to column 1, file is ok now. We need to check actual column range.
@kolkov thanks for that very useful input!
The version of tealeg/xlsx is v3.3.4, and the v1 also has the same problem.
The returned excel file from backend service api and download through browser, then open it and the Microsoft Excel will thorw a warning message:
If I click yes, the excel file will be repaired successfully and can be opened.
My backend service use Gin framework and the summary code to generate excel file and return it to browser as bellow: