The default font is important because the cell sizes are derived from it. POI adds a default font because Excel requires there to be one; we used to swap it for our own like this: workbook,getStylseSource().getFonts().clear() // create a font as normal, it becomes the default by virtue of being first Unfortunately that no longer works as Javen (quite reasonably) made the returned list an unmodifiable one in r1721857. So I propose we add some proper API to replace the default font, e.g. add to StylesTable: void replaceDefaultFont(XSSFFont font)
Would XSSFFont defaultFont = StylesTable.getFonts().get(0); // mutate defaultFont as needed work? StylesTable.getDefaultFont() would be convenient here, returning a reference to the current default font in the styles table replaceDefaultFont(XSSFFont font) would be tricky because XSSFFonts have an immutable index (into the font table?). All the mutable fields could be copied from the passed-in font to the default font.
Thanks Javen. That approach works for us, so no POI change necessary after all.