本文整理汇总了C#中NPOI.HSSF.Record.ObjRecord类的典型用法代码示例。如果您正苦于以下问题:C# ObjRecord类的具体用法?C# ObjRecord怎么用?C# ObjRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjRecord类属于NPOI.HSSF.Record命名空间,在下文中一共展示了ObjRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HSSFShape
/**
* creates shapes from existing file
* @param spContainer
* @param objRecord
*/
public HSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord)
{
this._escherContainer = spContainer;
this._objRecord = objRecord;
this._optRecord = (EscherOptRecord)spContainer.GetChildById(EscherOptRecord.RECORD_ID);
this.anchor = HSSFAnchor.CreateAnchorFromEscher(spContainer);
}
示例2: Test_47701
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);
}
示例3: TestConstruct
public void TestConstruct()
{
ObjRecord record = new ObjRecord();
CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
ftCmo.ObjectType = (CommonObjectType.COMMENT);
ftCmo.ObjectId = ((short)1024);
ftCmo.IsLocked = (true);
ftCmo.IsPrintable = (true);
ftCmo.IsAutoFill = (true);
ftCmo.IsAutoline = (true);
record.AddSubRecord(ftCmo);
EndSubRecord ftEnd = new EndSubRecord();
record.AddSubRecord(ftEnd);
//Serialize and Read again
byte[] recordBytes = record.Serialize();
//cut off the record header
byte[] bytes = new byte[recordBytes.Length - 4];
System.Array.Copy(recordBytes, 4, bytes, 0, bytes.Length);
record = new ObjRecord(TestcaseRecordInputStream.Create(ObjRecord.sid, bytes));
IList subrecords = record.SubRecords;
Assert.AreEqual(2, subrecords.Count);
Assert.IsTrue(subrecords[0] is CommonObjectDataSubRecord);
Assert.IsTrue(subrecords[1] is EndSubRecord);
}
示例4: TestStore
public void TestStore()
{
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.Create(ObjRecord.sid, recdata));
byte[] recordBytes = record.Serialize();
Assert.AreEqual(26, recordBytes.Length - 4);
byte[] subData = new byte[recdata.Length];
System.Array.Copy(recordBytes, 4, subData, 0, subData.Length);
Assert.IsTrue(NPOI.Util.Arrays.Equals(recdata, subData));
}
示例5: TestLoad
public void TestLoad()
{
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.Create(ObjRecord.sid, recdata));
Assert.AreEqual(26, record.RecordSize - 4);
IList subrecords = record.SubRecords;
Assert.AreEqual(2, subrecords.Count);
Assert.IsTrue(subrecords[0] is CommonObjectDataSubRecord);
Assert.IsTrue(subrecords[1] is EndSubRecord);
}
示例6: TestReadAll_bug45778
public void TestReadAll_bug45778()
{
RecordInputStream in1 = TestcaseRecordInputStream.Create(dataAutoFilter);
ObjRecord or = new ObjRecord(in1);
byte[] data2 = or.Serialize();
if (data2.Length == 8228)
{
throw new AssertionException("Identified bug 45778");
}
Assert.AreEqual(74, data2.Length);
Assert.IsTrue(Arrays.Equals(dataAutoFilter, data2));
}
示例7: CreateObjRecord
protected override ObjRecord CreateObjRecord()
{
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.ObjectType = CommonObjectType.TEXT;
c.IsLocked = (true);
c.IsPrintable = (true);
c.IsAutoFill = (true);
c.IsAutoline = (true);
EndSubRecord e = new EndSubRecord();
obj.AddSubRecord(c);
obj.AddSubRecord(e);
return obj;
}
示例8: TestCreateAggregate
public void TestCreateAggregate()
{
String msoDrawingRecord1 =
"0F 00 02 F0 20 01 00 00 10 00 08 F0 08 00 00 00 " +
"03 00 00 00 02 04 00 00 0F 00 03 F0 08 01 00 00 " +
"0F 00 04 F0 28 00 00 00 01 00 09 F0 10 00 00 00 " +
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " +
"02 00 0A F0 08 00 00 00 00 04 00 00 05 00 00 00 " +
"0F 00 04 F0 64 00 00 00 42 01 0A F0 08 00 00 00 " +
"01 04 00 00 00 0A 00 00 73 00 0B F0 2A 00 00 00 " +
"BF 00 08 00 08 00 44 01 04 00 00 00 7F 01 00 00 " +
"01 00 BF 01 00 00 11 00 C0 01 40 00 00 08 FF 01 " +
"10 00 10 00 BF 03 00 00 08 00 00 00 10 F0 12 00 " +
"00 00 00 00 01 00 54 00 05 00 45 00 01 00 88 03 " +
"05 00 94 00 00 00 11 F0 00 00 00 00";
String msoDrawingRecord2 =
"0F 00 04 F0 64 00 00 00 42 01 0A F0 08 00 00 00 " +
"02 04 00 00 80 0A 00 00 73 00 0B F0 2A 00 00 00 " +
"BF 00 08 00 08 00 44 01 04 00 00 00 7F 01 00 00 " +
"01 00 BF 01 00 00 11 00 C0 01 40 00 00 08 FF 01 " +
"10 00 10 00 BF 03 00 00 08 00 00 00 10 F0 12 00 " +
"00 00 00 00 01 00 8D 03 05 00 E4 00 03 00 4D 03 " +
"0B 00 0C 00 00 00 11 F0 00 00 00 00";
DrawingRecord d1 = new DrawingRecord();
d1.Data = (HexRead.ReadFromString(msoDrawingRecord1));
ObjRecord r1 = new ObjRecord();
DrawingRecord d2 = new DrawingRecord();
d2.Data = (HexRead.ReadFromString(msoDrawingRecord2));
ObjRecord r2 = new ObjRecord();
ArrayList records = new ArrayList();
records.Add(d1);
records.Add(r1);
records.Add(d2);
records.Add(r2);
DrawingManager2 drawingManager = new DrawingManager2(new EscherDggRecord());
EscherAggregate aggregate = EscherAggregate.CreateAggregate(records, 0, drawingManager);
Assert.AreEqual(1, aggregate.EscherRecords.Count);
Assert.AreEqual(unchecked((short)0xF002), aggregate.GetEscherRecord(0).RecordId);
Assert.AreEqual(2, aggregate.GetEscherRecord(0).ChildRecords.Count);
// System.out.println( "aggregate = " + aggregate );
}
示例9: CreateObjRecord
protected override ObjRecord CreateObjRecord()
{
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.ObjectType = CommonObjectType.ComboBox;
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;
}
示例10: CreateObjRecord
/// <summary>
/// Creates the lowerlevel OBJ records for this shape.
/// </summary>
/// <param name="hssfShape">The HSSF shape.</param>
/// <param name="shapeId">The shape id.</param>
/// <returns></returns>
private ObjRecord CreateObjRecord(HSSFTextbox hssfShape, int shapeId)
{
HSSFShape shape = hssfShape;
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.ObjectType = (CommonObjectType)((HSSFSimpleShape)shape).ShapeType;
c.ObjectId = GetCmoObjectId(shapeId);
c.IsLocked = true;
c.IsPrintable = true;
c.IsAutoFill = true;
c.IsAutoline = true;
EndSubRecord e = new EndSubRecord();
obj.AddSubRecord(c);
obj.AddSubRecord(e);
return obj;
}
示例11: HSSFShapeGroup
public HSSFShapeGroup(EscherContainerRecord spgrContainer, ObjRecord objRecord)
: base(spgrContainer, objRecord)
{
// read internal and external coordinates from spgrContainer
EscherContainerRecord spContainer = spgrContainer.ChildContainers[0];
_spgrRecord = (EscherSpgrRecord)spContainer.GetChild(0);
foreach (EscherRecord ch in spContainer.ChildRecords)
{
switch (ch.RecordId)
{
case EscherSpgrRecord.RECORD_ID:
break;
case EscherClientAnchorRecord.RECORD_ID:
anchor = new HSSFClientAnchor((EscherClientAnchorRecord)ch);
break;
case EscherChildAnchorRecord.RECORD_ID:
anchor = new HSSFChildAnchor((EscherChildAnchorRecord)ch);
break;
}
}
}
示例12: CreateObjRecord
/**
* 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= (short)shapeId;
c.IsLocked=(true);
c.IsPrintable=false;
c.IsAutoFill=true;
c.IsAutoline=false;
LbsDataSubRecord l = LbsDataSubRecord.CreateAutoFilterInstance();
EndSubRecord e = new EndSubRecord();
obj.AddSubRecord(c);
obj.AddSubRecord(l);
obj.AddSubRecord(e);
return obj;
}
示例13: Test_45778
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);
}
示例14: HSSFTextbox
public HSSFTextbox(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord)
: base(spContainer, objRecord, textObjectRecord)
{
}
示例15: HSSFSimpleShape
public HSSFSimpleShape(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord)
: base(spContainer, objRecord)
{
this._textObjectRecord = textObjectRecord;
}