Hi,
When I make a copy of a xls file that has macros in it, the macros are missing in the copy.
I call the openWorkBookCopy(...) method, add some cell data, then call saveWorkBook(...).
I get everything else in the copy such as images and formatting. The copy looks great, but the macros are missing.
Any ideas?
Thanks!
(Below is my helper class with the methods I call)
public void openWorkBookCopy(String sourceFileUrl)
throws IOException
{
URL inUrl = new URL(sourceFileUrl);
URLConnection inConnection = inUrl.openConnection();
inConnection.setDoInput(true);
InputStream inStream = null;
try
{
inStream = inConnection.getInputStream();
Workbook sourceWorkbook = new Workbook();
workbookCopy = new Workbook();
sourceWorkbook.open(inStream);
workbookCopy.copy(sourceWorkbook);
}
finally
{
if(inStream != null)
inStream.close();
}
}
public void saveWorkBook(String fileName) throws IOException
{
if(workbookCopy!=null)
workbookCopy.save(fileName);//,FileFormatType.EXCEL97);
}