excel-templates icon indicating copy to clipboard operation
excel-templates copied to clipboard

If you alter a column name used in your template, Excel complains

Open tjg opened this issue 9 years ago • 3 comments

Minimal test case: https://github.com/tjg/excel-templates-test-tables

If a template has a table, and you change a column name, Excel will complain. In a way which reduces the trust of someone who reads the Excel file.

tjg avatar Mar 15 '17 17:03 tjg

Hmm, examining excel-template's sourcecode, I may have to do something fancy to make this work. Like my questionable little hack to extend tables to the end of the data.

(I understand if changing table column-names is such an uncommon thing to do that this may be a WONTFIX.)

BTW, thanks for excel-template! A truly excellent lib, makes life so easy.

tjg avatar Mar 15 '17 20:03 tjg

Ok, seems the solution is to call .updateHeaders on each XSSFTable.

Works on my test repo, but not yet on my real-world Excel files...

tjg avatar Mar 15 '17 21:03 tjg

Hmm, for my real-world Excel files, looks like the new column names aren't going into the shared strings table. So presumably I'm supposed to call org.apache.poi.xssf.model.SharedStringsTable.addEntry(), but now I have to figure out how to write it back into the Excel document...

Eh. Maybe the whole idea of modifying a table's column names is just not worth it.

tjg avatar Mar 15 '17 22:03 tjg