question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in /xl/styles.xml-Part caused by Table Style (Reproducable)

See original GitHub issue

Read and complete the full issue template

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

Version of ClosedXML

.0.95.999.2326

What is the current behavior?

Copying a worksheet will give an error as above (Repaired Records: Table Style from /xl/styles.xml part (Styles))

What is the expected behavior or new feature?

No error

Is this a regression from the previous version? Yes: v0.95.4 bug v0.95.3 bug v0.94.2 bug v0.93.1 bug v0.92.1 working

Reproducibility

Always:

  • Choose “Format as table”
  • Add new Table Style
  • Set “Whole Table” to “No Borders”
  • Copy a sheet with ClosedXML an save it
  • Open with Excel and get the above error

Code to reproduce problem:

static void Main(string[] args) {
            File.Copy("test.xlsx", "copy.xlsx", true);
            using XLWorkbook wb = new("copy.xlsx");

            bool res = wb.TryGetWorksheet("Original", out IXLWorksheet sheet);

            sheet = sheet.CopyTo(wb, "copy");

            wb.Save();
            
        }

test.xlsx

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jahavcommented, Apr 12, 2023

Not any concrete plans. Priority ATM is to deal with PRs.

0reactions
akadecommented, May 17, 2023

Just encountered a similar (if not the same) bug on the latest version (0.101.0) Just having any custom table style “corrupts” the worksheet when saving again:

using ClosedXML.Excel;

using XLWorkbook workbook = new(@"Test.xlsx");
workbook.SaveAs(@"Outputxlsx");

The excel file Test.xlsx is completly empty except a single custom table style. Maybe this helps whenever somebody finds some time to look into this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repaired Records: Format from /xl/styles.xml part
Yes, this error indicates some format in the workbook make the content unreadable, and Excel has tried to repair the format. After this...
Read more >
Style from /xl/styles.xml part (styles) Undreadable Content
After clicking Yes, then another error appeared saying: "Excel was able to open teh file by repairing or removing the unreadable content. Removed...
Read more >
Apache POI Excel styles problem when creating two or ...
The problem was that while the font was written into a private class variable and reused afterwards, the important part that was missing...
Read more >
Reading Excel Files-- Styles.xml error
It's possible they have a bad formula, and the style.xml was removed from the file. That Excel file maybe corrupt.Also, there are no...
Read more >
openxlsx loadworkbook
Removed Part: /xl/styles.xml part with XML error. colNames If TRUE, the first row of data will ... I had a custom table style...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found