Created attachment 28048 [details] Template File Hi, Iam using templateFiles (*.xlt) and want to copy some sheets to reuse them. The template files contains a image. But during the copy progress I got the following error: WARNING: 8 bytes remaining but no space left When I want to open the new file afterwards I got a Errormessage and Excel repairs it. After that the file is open and still looks good (Image is on both sheets). I attached the template file and a litte Testprogram. public class POITemplateCopyTest { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { InputStream is = new FileInputStream(new File("D:\\BugReport\\SourceTemplate.xlt")); POIFSFileSystem poifs = new POIFSFileSystem(is); HSSFWorkbook wb = new HSSFWorkbook(poifs); is.close(); wb.cloneSheet(1); wb.write(new FileOutputStream(new File("D:\\BugReport\\TemplateTestCopy.xls"))); System.out.println("Done"); } }
Created attachment 28049 [details] Created corrupted File
Created attachment 28050 [details] Testprogram
*** Bug 52312 has been marked as a duplicate of this bug. ***
Hi. I had even bug. More often it becomes apparent for cloning sheets with shapes. And when I clone sheet with 20 images and 3 shapes, I have exception: WARNING: 32 bytes remaining but no space left WARNING: 136 bytes remaining but no space left WARNING: 32 bytes remaining but no space left WARNING: 136 bytes remaining but no space left WARNING: 32 bytes remaining but no space left WARNING: 136 bytes remaining but no space left WARNING: 32 bytes remaining but no space left WARNING: 136 bytes remaining but no space left Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException: 9192 bytes written but getRecordSize() reports 9296 at org.apache.poi.hssf.record.EscherAggregate.serialize(EscherAggregate.java:488) at org.apache.poi.hssf.usermodel.HSSFWorkbook$SheetRecordCollector.serialize(HSSFWorkbook.java:1263) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1309) at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1209) at TestWorkbookCreating.main(TestWorkbookCreating.java:44) I added this file to attachments.
Created attachment 28067 [details] Xls-file with 20 images and 3 shapes During cloning the shape with name "cb_en" of this file occurs an exception.
This problem should be fixed in trunk. Please try with a nightly build - see download links on http://poi.apache.org/ or build yourself from SVN trunk, see http://poi.apache.org/subversion.html