Patch from Josh from bug #44510 - Fix how DVALRecord works with dropdowns

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@633151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-03-03 16:09:02 +00:00
parent 0102c66498
commit a16fa738f0
4 changed files with 66 additions and 9 deletions

View File

@ -36,6 +36,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.1-beta1" date="2008-??-??"> <release version="3.1-beta1" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">44510 - Fix how DVALRecord works with dropdowns</action>
<action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action> <action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
<action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action> <action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
<action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action> <action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>

View File

@ -33,6 +33,9 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.1-beta1" date="2008-??-??"> <release version="3.1-beta1" date="2008-??-??">
<action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
<action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
<action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>
<action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action> <action dev="POI-DEVELOPERS" type="fix">44495 - Handle named cell ranges in formulas that have lower case parts</action>
<action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action> <action dev="POI-DEVELOPERS" type="fix">44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF</action>
<action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action> <action dev="POI-DEVELOPERS" type="fix">44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this</action>

View File

@ -1,4 +1,3 @@
/* ==================================================================== /* ====================================================================
Copyright 2002-2004 Apache Software Foundation Copyright 2002-2004 Apache Software Foundation
@ -20,13 +19,11 @@ package org.apache.poi.hssf.record;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
/** /**
* Title: DVAL Record<P> * Title: DATAVALIDATIONS Record<P>
* Description: used in data validation ; * Description: used in data validation ;
* This record is the list header of all data validation records in the current sheet. * This record is the list header of all data validation records (0x01BE) in the current sheet.
* @author Dragos Buleandra (dragos.buleandra@trade2b.ro) * @author Dragos Buleandra (dragos.buleandra@trade2b.ro)
* @version 2.0-pre
*/ */
public class DVALRecord extends Record public class DVALRecord extends Record
{ {
public final static short sid = 0x01B2; public final static short sid = 0x01B2;
@ -41,13 +38,14 @@ public class DVALRecord extends Record
/** Object ID of the drop down arrow object for list boxes ; /** Object ID of the drop down arrow object for list boxes ;
* in our case this will be always FFFF , until * in our case this will be always FFFF , until
* MSODrawingGroup and MSODrawing records are implemented */ * MSODrawingGroup and MSODrawing records are implemented */
private int field_cbo_id = 0xFFFFFFFF; private int field_cbo_id;
/** Number of following DV Records */ /** Number of following DV Records */
private int field_5_dv_no = 0x00000000; private int field_5_dv_no;
public DVALRecord() public DVALRecord() {
{ field_cbo_id = 0xFFFFFFFF;
field_5_dv_no = 0x00000000;
} }
/** /**

View File

@ -0,0 +1,55 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import java.io.ByteArrayInputStream;
import org.apache.poi.util.LittleEndian;
import junit.framework.TestCase;
/**
*
* @author Josh Micich
*/
public final class TestDVALRecord extends TestCase {
public void testRead() {
byte[] data = new byte[22];
LittleEndian.putShort(data, 0, DVALRecord.sid);
LittleEndian.putShort(data, 2, (short)18);
LittleEndian.putShort(data, 4, (short)55);
LittleEndian.putInt(data, 6, 56);
LittleEndian.putInt(data, 10, 57);
LittleEndian.putInt(data, 14, 58);
LittleEndian.putInt(data, 18, 59);
RecordInputStream in = new RecordInputStream(new ByteArrayInputStream(data));
in.nextRecord();
DVALRecord dv = new DVALRecord(in);
assertEquals(55, dv.getOptions());
assertEquals(56, dv.getHorizontalPos());
assertEquals(57, dv.getVerticalPos());
assertEquals(58, dv.getObjectID());
if(dv.getDVRecNo() == 0) {
fail("Identified bug 44510");
}
assertEquals(59, dv.getDVRecNo());
}
}