Is there some reason that you're not using File.copy?

Mark

On Fri, Aug 6, 2010 at 6:31 AM, Aram Mirzadeh <[email protected]> wrote:

>
> Hi,
>
> I have a template XSLM file that I use as the basis for the output file.
> In HSSF I just duplicated the workbook via:
>
>        private static POIFSFileSystem duplicateTemplate(final String
> outputExcelFile, final String templateFile) {
>                POIFSFileSystem fs = null;
>                FileOutputStream output = null;
>                try {
>                        output = new FileOutputStream(outputExcelFile);
>                } catch (final FileNotFoundException e) {
>                        logger.fatal("Fatal error file not found", e);
>                        System.exit(-1);
>                }
>                HSSFWorkbook wb = null;
>
>                try {
>                        fs = new POIFSFileSystem(new
> FileInputStream(templateFile));
>                        wb = new HSSFWorkbook(fs);
>                } catch (final Exception e) {
>                        logger.fatal("FATAL: " + e);
>                        System.exit(-1);
>                }
>
>                try {
>                        wb.write(output);
>                        output.close();
>                } catch (final IOException e) {
>                        logger.fatal("Error while closing out file", e);
>                        System.exit(-1);
>                }
>                return (fs);
>        }
>
> In XSSF this seems to be a lot more difficult.  Am I missing something?  Is
> there a helper that allows duplication of a full workbook to another without
> having to go through everything recursively?
>
> Thanks.
>
> Aram
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to