Rule M2.4 exception : this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that triggers it, thanks!
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xssf.write(bos);
xssf.close();
fileData = bos.toByteArray();
触发了一个 openxml 的 bug
http://apache-poi.1045710.n5.nabble.com/OpenXML4JRuntimeException-Rule-M2-4-exception-this-error-should-NEVER-happen-td5710532.html
不过我更怀疑你作为模板的原文件本身有问题,比如不是微软office创建的,或者版本不兼容。