poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aram Mirzadeh <...@mbcli.com>
Subject Re: Fatests method of Duplicating a XSSF workbook
Date Fri, 06 Aug 2010 15:14:40 GMT

Really the only reason is the verification of the content being actually 
a valid excel file.   Although I can come up with something else during 
the template upload to verify that and not do it here.

On 8/6/2010 10:55 AM, Mark Fortner wrote:
> Is there some reason that you're not using File.copy?
>
> Mark
>
> On Fri, Aug 6, 2010 at 6:31 AM, Aram Mirzadeh<awm@mbcli.com>  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: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>>      
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message