DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28203>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28203 [PATCH] Unable to open read-write excel file including forms [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Unable to open read-write |[PATCH] Unable to open read- |excel file including forms |write excel file including | |forms ------- Additional Comments From [EMAIL PROTECTED] 2004-06-17 12:49 ------- I got this to work by making the following corrections to AbstractEscherHolderRecord.java (in package org.apache.poi.hssf.records). Replace the serialize() and getRecordSize() methods with the code below [CODE] public int serialize(int offset, byte[] data) { LittleEndian.putShort(data, 0 + offset, getSid()); LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); if (escherRecords.size() == 0 && rawData != null) { System.arraycopy( rawData, 0, data, offset + 4, rawData.length); } else { int pos = offset + 4; for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { EscherRecord r = (EscherRecord) iterator.next(); pos += r.serialize(pos, data, new NullEscherSerializationListener() ); } } return getRecordSize(); } /** * Size of record (including 4 byte header) */ public int getRecordSize() { if (escherRecords.size() == 0 && rawData != null) { return rawData.length + 4; } else { int size = 4; for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); ) { EscherRecord r = (EscherRecord) iterator.next(); size += r.getRecordSize(); } return size; } } [/CODE] The problem is in serialization of the Escher records (MSODRAWING, MSODRAWINGGROUP, and MSODRAWINGSELECTION). Even though your spreadsheet contains no images, forms controls are positioned on the page using the Escher layer, so the new Escher code is involved. The new Escher code will not parse an the Escher records until you actually make a drawing. Until you use the ddf package, it just holds the data of each Escher record as raw bytes. But if you attempt to write these raw bytes back, there is a logic problem where the MSODRAWINGGROUP (and other) record is not reconstructed correctly -- namely, the required four byte BIFF record header is omitted. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
