:
Here's my code :
File tplfile = null;
OpcPackage tpl = null;
SpreadsheetMLPackage pkg = null;
FileOutputStream os = null;
InputStream is = null;
Logger.getLogger(ExcelWriter.class.getName()).info("Getting template : template.xslm");
try
{
is = ExcelWriter.class.getResource("template.xlsm").openStream();
tplfile = File.createTempFile("tpl", ".xslm");
tplfile.deleteOnExit();
os = new FileOutputStream(tplfile);
byte temp = new byte;
int rc;
while((rc = is.read(temp)) > 0)
{
os.write(temp, 0, rc);
}
is.close();
os.close();
}
catch(IOException ex)
{
Logger.getLogger(WordWriter.class.getName()).error("IO Exception");
}
try
{
tpl = OpcPackage.load(tplfile); ...