Fixed size of TblPtg

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@689544 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-08-27 18:13:46 +00:00
parent 04dfa8d39f
commit d7b932dee2
1 changed files with 30 additions and 34 deletions

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndian;
* It only occurs in a FORMULA record, never in an * It only occurs in a FORMULA record, never in an
* ARRAY or NAME record. When ptgTbl occurs in a * ARRAY or NAME record. When ptgTbl occurs in a
* formula, it is the only token in the formula. * formula, it is the only token in the formula.
* (TODO - check this when processing) *
* This indicates that the cell containing the * This indicates that the cell containing the
* formula is an interior cell in a data table; * formula is an interior cell in a data table;
* the table description is found in a TABLE * the table description is found in a TABLE
@ -38,36 +38,33 @@ import org.apache.poi.util.LittleEndian;
* See page 811 of the june 08 binary docs. * See page 811 of the june 08 binary docs.
*/ */
public final class TblPtg extends ControlPtg { public final class TblPtg extends ControlPtg {
private final static int SIZE = 4; private final static int SIZE = 5;
public final static short sid = 0x2; public final static short sid = 0x02;
/** The row number of the upper left corner */ /** The row number of the upper left corner */
private final short field_1_first_row; private final int field_1_first_row;
/** The column number of the upper left corner */ /** The column number of the upper left corner */
private final short field_2_first_col; private final int field_2_first_col;
public TblPtg(RecordInputStream in) public TblPtg(RecordInputStream in) {
{ field_1_first_row = in.readUShort();
field_1_first_row = in.readShort(); field_2_first_col = in.readUShort();
field_2_first_col = in.readUByte();
} }
public void writeBytes(byte [] array, int offset) public void writeBytes(byte [] array, int offset) {
{ LittleEndian.putByte(array, offset+0, sid);
array[offset+0]= (byte) (sid); LittleEndian.putUShort(array, offset+1, field_1_first_row);
LittleEndian.putShort(array,offset+1,field_1_first_row); LittleEndian.putUShort(array, offset+3, field_2_first_col);
LittleEndian.putByte(array,offset+3,field_2_first_col);
} }
public int getSize() public int getSize() {
{
return SIZE; return SIZE;
} }
public short getRow() { public int getRow() {
return field_1_first_row; return field_1_first_row;
} }
public short getColumn() { public int getColumn() {
return field_2_first_col; return field_2_first_col;
} }
@ -77,8 +74,7 @@ public final class TblPtg extends ControlPtg {
throw new RecordFormatException("Table and Arrays are not yet supported"); throw new RecordFormatException("Table and Arrays are not yet supported");
} }
public String toString() public String toString() {
{
StringBuffer buffer = new StringBuffer("[Data Table - Parent cell is an interior cell in a data table]\n"); StringBuffer buffer = new StringBuffer("[Data Table - Parent cell is an interior cell in a data table]\n");
buffer.append("top left row = ").append(getRow()).append("\n"); buffer.append("top left row = ").append(getRow()).append("\n");
buffer.append("top left col = ").append(getColumn()).append("\n"); buffer.append("top left col = ").append(getColumn()).append("\n");