MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

Problem inserting into Excel Tables - results in a corrupted file, aft. repair the output is not what we expect...

Open hidegh opened this issue 6 months ago • 3 comments

Excel Type

  • [x] XLSX
  • [ ] XLSM
  • [ ] CSV
  • [ ] OTHER

Upload Excel File

meTemplate.xlsx

MiniExcel Version

1.41.3

Description

I have set up a table in excel - reason:

  • easier to do subtotals
  • formatting

The output aft. repairing hte corrupted file looks like this:

Image

Whereas the setup was:

Image

hidegh avatar Aug 20 '25 14:08 hidegh

This is actually related to the DateTime problem you mentioned in #856. Fundamentally, the problem can be reduced to mapping the generated data to the correct style, formatting, etc... which is something that wasn't really thought of when the templating system was originally implemented. You could partially work around this by moving the children table just below the balance in your template, this would fix the headers but still won't extend the table to include your data. I'm sorry to let you down but it will probably take an extensive amount of time to address the issue appropriately and make the necessary changes to fix it.

michelebastione avatar Aug 23 '25 22:08 michelebastione

Not sure that it relates to the DateTime - it is just rendered as a string, not as an int, so Excel is fine with that. So that's a different issue, but fairly easy to fix, especially if we leave it to EXCEL to handle how the date (integer) gets formatted and displayed.

This problem showed up just when I started to use TABLES inside Excel, and the problem is twofold:

  • corrupted file
  • header generation

There should be no header generation by default, especially not within tables, but even so, I doubt the corrupted file is due to that extra header...rather some other OpenXML structure thing.

hidegh avatar Aug 28 '25 14:08 hidegh

I apologize for not explaining myself comprehensively. There is in fact, no header generation. The header is the same one from the table in your template, but it is pushed downwards by the other generated data and the file gets corrupted because the table can't find the referenced data anymore. That's why I suggested moving the whole table above the other generated content, as a workaraound, like I mentioned this will b very tricky to fix. I hope I managed to illustrate the issue in a clearer way.

michelebastione avatar Aug 28 '25 15:08 michelebastione