/** * Creates the low level OBJ record for this shape. */ private ObjRecord CreateObjRecord(HSSFSimpleShape shape, int shapeId) { ObjRecord obj = new ObjRecord(); CommonObjectDataSubRecord c = new CommonObjectDataSubRecord(); c.ObjectType = CommonObjectType.COMBO_BOX; c.ObjectId = shapeId; c.IsLocked = true; c.IsPrintable = false; c.IsAutoFill = true; c.IsAutoline = false; FtCblsSubRecord f = new FtCblsSubRecord(); LbsDataSubRecord l = LbsDataSubRecord.CreateAutoFilterInstance(); EndSubRecord e = new EndSubRecord(); obj.AddSubRecord(c); obj.AddSubRecord(f); obj.AddSubRecord(l); obj.AddSubRecord(e); return(obj); }
public void Test_45778() { byte[] data = HexRead.ReadFromString( "15, 00, 12, 00, 14, 00, 01, 00, 01, 00, " + "01, 21, 00, 00, 3C, 13, F4, 03, 00, 00, " + "00, 00, 0C, 00, 14, 00, 00, 00, 00, 00, " + "00, 00, 00, 00, 00, 00, 01, 00, 08, 00, 00, " + "00, 10, 00, 00, 00, " + "13, 00, EE, 1F, " + "00, 00, " + "08, 00, " + //number of items "08, 00, " + //selected item "01, 03, " + //flags "00, 00, " + //objId //LbsDropData "0A, 00, " + //flags "14, 00, " + //the number of lines to be displayed in the dropdown "6C, 00, " + //the smallest width in pixels allowed for the dropdown window "00, 00, " + //num chars "00, 00"); RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, data); // check read OK ObjRecord record = new ObjRecord(in1); SubRecord sr = record.SubRecords[(2)]; Assert.IsTrue(sr is LbsDataSubRecord); LbsDataSubRecord lbs = (LbsDataSubRecord)sr; Assert.AreEqual(8, lbs.NumberOfItems); Assert.IsNull(lbs.Formula); // check that it re-Serializes to the same data byte[] ser = record.Serialize(); TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, ser); }
public void Test_47701() { byte[] data = HexRead.ReadFromString( "15, 00, 12, 00, 12, 00, 02, 00, 11, 20, " + "00, 00, 00, 00, 80, 3D, 03, 05, 00, 00, " + "00, 00, 0C, 00, 14, 00, 00, 00, 00, 00, " + "00, 00, 00, 00, 00, 00, 01, 00, 0A, 00, " + "00, 00, 10, 00, 01, 00, 13, 00, EE, 1F, " + "10, 00, 09, 00, 40, 9F, 74, 01, 25, 09, " + "00, 0C, 00, 07, 00, 07, 00, 07, 04, 00, " + "00, 00, 08, 00, 00, 00"); RecordInputStream in1 = TestcaseRecordInputStream.Create(ObjRecord.sid, data); // check read OK ObjRecord record = new ObjRecord(in1); Assert.AreEqual(3, record.SubRecords.Count); SubRecord sr = record.SubRecords[(2)]; Assert.IsTrue(sr is LbsDataSubRecord); LbsDataSubRecord lbs = (LbsDataSubRecord)sr; Assert.AreEqual(4, lbs.NumberOfItems); Assert.IsTrue(lbs.Formula is AreaPtg); AreaPtg ptg = (AreaPtg)lbs.Formula; CellRangeAddress range = new CellRangeAddress( ptg.FirstRow, ptg.LastRow, ptg.FirstColumn, ptg.LastColumn); Assert.AreEqual("H10:H13", range.FormatAsString()); // check that it re-Serializes to the same data byte[] ser = record.Serialize(); TestcaseRecordInputStream.ConfirmRecordEncoding(ObjRecord.sid, data, ser); }
protected override ObjRecord CreateObjRecord() { ObjRecord obj = new ObjRecord(); CommonObjectDataSubRecord c = new CommonObjectDataSubRecord(); c.ObjectType = CommonObjectType.COMBO_BOX; c.IsLocked = (true); c.IsPrintable = (false); c.IsAutoFill = (true); c.IsAutoline = (false); FtCblsSubRecord f = new FtCblsSubRecord(); LbsDataSubRecord l = LbsDataSubRecord.CreateAutoFilterInstance(); EndSubRecord e = new EndSubRecord(); obj.AddSubRecord(c); obj.AddSubRecord(f); obj.AddSubRecord(l); obj.AddSubRecord(e); return(obj); }