In my project, I have one standard excel template file (std.xls). Before
saving any data to new file (yyy.xls), we would like to create a copy
from this standard template file (std.xls) to new file (yyy.xls) and
then save data in new file (yyy.xls). The reason behind this is that we
have some predefined formatted headers that we want to available in
every new file. So that we need to write only data in new file and don't
need to worry about formatting headers. Since I don't want to use
platform specific system call (i.e. exec(copy command)), I used a
following simple approach to copy file.  

 

                  FileInputStream fis = new FileInputStream(fileFrom);


                  FileOutputStream fos = new FileOutputStream(fileTo);


                  int dateigroesse = fis.available();             

                  byte[] puffer = new byte[dateigroesse];               

                  fis.read(puffer, 0, dateigroesse);              

                  fos.write(puffer, 0, puffer.length);                  

                  fis.close();                  

                  fos.close();

 

Buy this way, the new file doesn't hold predefined formatted headers.
But I really like to have predefined formatted headers copied to new
file. How can I do that? 

 

Thanks in advance. 

 

Prashant Patel

 

Reply via email to