本文整理汇总了C#中NPOI.DDF.EscherContainerRecord类的典型用法代码示例。如果您正苦于以下问题:C# EscherContainerRecord类的具体用法?C# EscherContainerRecord怎么用?C# EscherContainerRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EscherContainerRecord类属于NPOI.DDF命名空间,在下文中一共展示了EscherContainerRecord类的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: CreateSpContainer
/**
* 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;
//}
/**
* Generates the escher shape records for this shape.
*/
private EscherContainerRecord CreateSpContainer(HSSFSimpleShape shape, int shapeId)
{
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.RecordId=(EscherContainerRecord.SP_CONTAINER);
spContainer.Options=((short)0x000F);
sp.RecordId=(EscherSpRecord.RECORD_ID);
sp.Options=((short)((EscherAggregate.ST_HOSTCONTROL << 4) | 0x2));
sp.ShapeId=(shapeId);
sp.Flags=(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
opt.RecordId=(EscherOptRecord.RECORD_ID);
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 17039620));
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 0x00080008));
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080000));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00020000));
HSSFClientAnchor userAnchor = (HSSFClientAnchor)shape.Anchor;
userAnchor.AnchorType = (AnchorType)1;
EscherRecord anchor = CreateAnchor(userAnchor);
clientData.RecordId=(EscherClientDataRecord.RECORD_ID);
clientData.Options=((short)0x0000);
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spContainer;
}
示例3: CreateSpContainer
/**
* Create a new Shape
*
* @param isChild <code>true</code> if the Line is inside a group, <code>false</code> otherwise
* @return the record Container which holds this shape
*/
protected EscherContainerRecord CreateSpContainer(bool IsChild)
{
_escherContainer = new EscherContainerRecord();
_escherContainer.SetRecordId(EscherContainerRecord.SP_CONTAINER);
_escherContainer.SetOptions((short)15);
EscherSpRecord sp = new EscherSpRecord();
int flags = EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
if (isChild) flags |= EscherSpRecord.FLAG_CHILD;
sp.SetFlags(flags);
_escherContainer.AddChildRecord(sp);
EscherOptRecord opt = new EscherOptRecord();
opt.SetRecordId(EscherOptRecord.RECORD_ID);
_escherContainer.AddChildRecord(opt);
EscherRecord anchor;
if (isChild) anchor = new EscherChildAnchorRecord();
else
{
anchor = new EscherClientAnchorRecord();
//hack. internal variable EscherClientAnchorRecord.shortRecord can be
//Initialized only in FillFields(). We need to Set shortRecord=false;
byte[] header = new byte[16];
LittleEndian.PutUshort(header, 0, 0);
LittleEndian.PutUshort(header, 2, 0);
LittleEndian.PutInt(header, 4, 8);
anchor.FillFields(header, 0, null);
}
_escherContainer.AddChildRecord(anchor);
return _escherContainer;
}
示例4: CreateSpContainer
/// <summary>
/// Creates the lowerlevel escher records for this shape.
/// </summary>
/// <param name="hssfShape">The HSSF shape.</param>
/// <param name="shapeId">The shape id.</param>
/// <returns></returns>
private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
{
HSSFShape shape = hssfShape;
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.RecordId=EscherContainerRecord.SP_CONTAINER;
spContainer.Options=(short)0x000F;
sp.RecordId=EscherSpRecord.RECORD_ID;
short shapeType = objTypeToShapeType(hssfShape.ShapeType);
sp.Options=(short)((shapeType << 4) | 0x2);
sp.ShapeId=shapeId;
sp.Flags=EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
opt.RecordId=EscherOptRecord.RECORD_ID;
AddStandardOptions(shape, opt);
EscherRecord anchor = CreateAnchor(shape.Anchor);
clientData.RecordId=EscherClientDataRecord.RECORD_ID;
clientData.Options=(short)0x0000;
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spContainer;
}
示例5: TestToString
public void TestToString()
{
EscherContainerRecord r = new EscherContainerRecord();
r.RecordId=EscherContainerRecord.SP_CONTAINER;
r.Options=(short)0x000F;
String nl = Environment.NewLine;
Assert.AreEqual("EscherContainerRecord (SpContainer):" + nl +
" isContainer: True" + nl +
" options: 0x000F" + nl +
" recordId: 0xF004" + nl +
" numchildren: 0" + nl
, r.ToString());
EscherOptRecord r2 = new EscherOptRecord();
r2.Options = unchecked((short)0x9876) ;
r2.RecordId=EscherOptRecord.RECORD_ID;
String expected;
r.AddChildRecord(r2);
expected = "EscherContainerRecord (SpContainer):" + nl +
" isContainer: True" + nl +
" options: 0x000F" + nl +
" recordId: 0xF004" + nl +
" numchildren: 1" + nl +
" children: " + nl +
" Child 0:" + nl +
"EscherOptRecord:" + nl +
" isContainer: False" + nl +
" options: 0x0003" + nl +
" recordId: 0xF00B" + nl +
" numchildren: 0" + nl +
" properties:" + nl;
Assert.AreEqual(expected, r.ToString());
r.AddChildRecord(r2);
expected = "EscherContainerRecord (SpContainer):" + nl +
" isContainer: True" + nl +
" options: 0x000F" + nl +
" recordId: 0xF004" + nl +
" numchildren: 2" + nl +
" children: " + nl +
" Child 0:" + nl +
"EscherOptRecord:" + nl +
" isContainer: False" + nl +
" options: 0x0003" + nl +
" recordId: 0xF00B" + nl +
" numchildren: 0" + nl +
" properties:" + nl +
" Child 1:" + nl +
"EscherOptRecord:" + nl +
" isContainer: False" + nl +
" options: 0x0003" + nl +
" recordId: 0xF00B" + nl +
" numchildren: 0" + nl +
" properties:" + nl;
Assert.AreEqual(expected, r.ToString());
}
示例6: HSSFPatriarch
/// <summary>
/// Creates the patriarch.
/// </summary>
/// <param name="sheet">the sheet this patriarch is stored in.</param>
/// <param name="boundAggregate">The bound aggregate.</param>
public HSSFPatriarch(HSSFSheet sheet, EscherAggregate boundAggregate)
{
_boundAggregate = boundAggregate;
_sheet = sheet;
_mainSpgrContainer = _boundAggregate.GetEscherContainer().ChildContainers[0];
EscherContainerRecord spContainer = (EscherContainerRecord)_boundAggregate.GetEscherContainer()
.ChildContainers[0].GetChild(0);
_spgrRecord = (EscherSpgrRecord)spContainer.GetChildById(EscherSpgrRecord.RECORD_ID);
BuildShapeTree();
}
示例7: CreateSpContainer
/**
* Generates the shape records for this shape.
*/
protected override EscherContainerRecord CreateSpContainer()
{
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
spContainer.Options = ((short)0x000F);
sp.RecordId = (EscherSpRecord.RECORD_ID);
sp.Options = ((short)((EscherAggregate.ST_NOT_PRIMATIVE << 4) | 0x2));
if (Parent == null)
{
sp.Flags = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
}
else
{
sp.Flags = (EscherSpRecord.FLAG_CHILD | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
}
opt.RecordId = (EscherOptRecord.RECORD_ID);
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.TRANSFORM__ROTATION, false, false, 0));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__RIGHT, false, false, 100));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__BOTTOM, false, false, 100));
opt.SetEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__FILLOK, false, false, 0x00010001));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x0));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDARROWHEAD, false, false, 0x0));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEENDCAPSTYLE, false, false, 0x0));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, 1));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
EscherRecord anchor = Anchor.GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spContainer;
}
示例8: CreateAnchorFromEscher
public static HSSFAnchor CreateAnchorFromEscher(EscherContainerRecord container)
{
if (null != container.GetChildById(EscherChildAnchorRecord.RECORD_ID))
{
return new HSSFChildAnchor((EscherChildAnchorRecord)container.GetChildById(EscherChildAnchorRecord.RECORD_ID));
}
else
{
if (null != container.GetChildById(EscherClientAnchorRecord.RECORD_ID))
{
return new HSSFClientAnchor((EscherClientAnchorRecord)container.GetChildById(EscherClientAnchorRecord.RECORD_ID));
}
return null;
}
}
示例9: CreateSpContainer
protected override EscherContainerRecord CreateSpContainer()
{
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
EscherTextboxRecord escherTextbox = new EscherTextboxRecord();
spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
spContainer.Options = ((short)0x000F);
sp.RecordId = (EscherSpRecord.RECORD_ID);
sp.Options = ((short)((EscherAggregate.ST_TEXTBOX << 4) | 0x2));
sp.Flags = (EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE);
opt.RecordId = (EscherOptRecord.RECORD_ID);
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTID, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__ANCHORTEXT, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTLEFT, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTRIGHT, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTTOP, 0));
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.TEXT__TEXTBOTTOM, 0));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEDASHING, LINESTYLE_SOLID));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x00080008));
opt.SetEscherProperty(new EscherSimpleProperty(EscherProperties.LINESTYLE__LINEWIDTH, LINEWIDTH_DEFAULT));
opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, FILL__FILLCOLOR_DEFAULT));
opt.SetEscherProperty(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, LINESTYLE__COLOR_DEFAULT));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, NO_FILLHITTEST_FALSE));
opt.SetEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x080000));
EscherRecord anchor = Anchor.GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
escherTextbox.RecordId = (EscherTextboxRecord.RECORD_ID);
escherTextbox.Options = ((short)0x0000);
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
spContainer.AddChildRecord(escherTextbox);
return spContainer;
}
示例10: CreateSpContainer
protected override EscherContainerRecord CreateSpContainer()
{
EscherContainerRecord spgrContainer = new EscherContainerRecord();
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpgrRecord spgr = new EscherSpgrRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherRecord anchor;
EscherClientDataRecord clientData = new EscherClientDataRecord();
spgrContainer.RecordId = (EscherContainerRecord.SPGR_CONTAINER);
spgrContainer.Options = ((short)0x000F);
spContainer.RecordId = (EscherContainerRecord.SP_CONTAINER);
spContainer.Options = (short)0x000F;
spgr.RecordId = (EscherSpgrRecord.RECORD_ID);
spgr.Options = (short)0x0001;
spgr.RectX1 = (0);
spgr.RectY1 = (0);
spgr.RectX2 = (1023);
spgr.RectY2 = (255);
sp.RecordId = (EscherSpRecord.RECORD_ID);
sp.Options = (short)0x0002;
if (this.Anchor is HSSFClientAnchor)
{
sp.Flags = (EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR);
}
else
{
sp.Flags = (EscherSpRecord.FLAG_GROUP | EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_CHILD);
}
opt.RecordId = (EscherOptRecord.RECORD_ID);
opt.Options = ((short)0x0023);
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00040004));
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.GROUPSHAPE__PRINT, 0x00080000));
anchor = Anchor.GetEscherAnchor();
clientData.RecordId = (EscherClientDataRecord.RECORD_ID);
clientData.Options = ((short)0x0000);
spgrContainer.AddChildRecord(spContainer);
spContainer.AddChildRecord(spgr);
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spgrContainer;
}
示例11: TestReadPNG
public void TestReadPNG()
{
//provided in bug-44886
byte[] data = _samples.ReadFile("Container.dat");
EscherContainerRecord record = new EscherContainerRecord();
record.FillFields(data, 0, new DefaultEscherRecordFactory());
EscherContainerRecord bstore = (EscherContainerRecord)record.ChildRecords[1];
EscherBSERecord bse1 = (EscherBSERecord)bstore.ChildRecords[0];
Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeWin32);
Assert.AreEqual(EscherBSERecord.BT_PNG, bse1.BlipTypeMacOS);
Assert.IsTrue(Arrays.Equals(new byte[]{
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
}, bse1.UID));
Assert.AreEqual(255, bse1.Tag);
Assert.AreEqual(32308, bse1.Size);
EscherBitmapBlip blip1 = (EscherBitmapBlip)bse1.BlipRecord;
Assert.AreEqual(0x6E00, blip1.Options);
Assert.AreEqual(EscherBitmapBlip.RECORD_ID_PNG, blip1.RecordId);
Assert.IsTrue(Arrays.Equals(new byte[]{
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
}, blip1.UID));
//Serialize and Read again
byte[] ser = bse1.Serialize();
EscherBSERecord bse2 = new EscherBSERecord();
bse2.FillFields(ser, 0, new DefaultEscherRecordFactory());
Assert.AreEqual(bse1.RecordId, bse2.RecordId);
Assert.AreEqual(bse1.BlipTypeWin32, bse2.BlipTypeWin32);
Assert.AreEqual(bse1.BlipTypeMacOS, bse2.BlipTypeMacOS);
Assert.IsTrue(Arrays.Equals(bse1.UID, bse2.UID));
Assert.AreEqual(bse1.Tag, bse2.Tag);
Assert.AreEqual(bse1.Size, bse2.Size);
EscherBitmapBlip blip2 = (EscherBitmapBlip)bse1.BlipRecord;
Assert.AreEqual(blip1.Options, blip2.Options);
Assert.AreEqual(blip1.RecordId, blip2.RecordId);
Assert.AreEqual(blip1.UID, blip2.UID);
Assert.IsTrue(Arrays.Equals(blip1.PictureData, blip1.PictureData));
}
示例12: 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;
}
}
}
示例13: CreateSpContainer
/// <summary>
/// Creates the lowerlevel escher records for this shape.
/// </summary>
/// <param name="hssfShape">The HSSF shape.</param>
/// <param name="shapeId">The shape id.</param>
/// <returns></returns>
private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
{
HSSFPicture shape = (HSSFPicture)hssfShape;
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherRecord anchor;
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.RecordId=EscherContainerRecord.SP_CONTAINER;
spContainer.Options=(short)0x000F;
sp.RecordId=EscherSpRecord.RECORD_ID;
sp.Options=(short)((EscherAggregate.ST_PICTUREFRAME << 4) | 0x2);
sp.ShapeId=shapeId;
sp.Flags=EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
opt.RecordId=EscherOptRecord.RECORD_ID;
// opt.AddEscherProperty( new EscherBoolProperty( EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x00800080 ) ;
opt.AddEscherProperty(new EscherSimpleProperty(EscherProperties.BLIP__BLIPTODISPLAY, false, true, shape.PictureIndex));
// opt.AddEscherProperty( new EscherComplexProperty( EscherProperties.BLIP__BLIPFILENAME, true, new byte[] { (byte)0x74, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x00, (byte)0x00 } ) ;
// opt.AddEscherProperty( new EscherSimpleProperty( EscherProperties.Fill__FillTYPE, 0x00000003 ) ;
AddStandardOptions(shape, opt);
HSSFAnchor userAnchor = shape.Anchor;
if (userAnchor.IsHorizontallyFlipped)
sp.Flags=sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ;
if (userAnchor.IsVerticallyFlipped)
sp.Flags=sp.Flags | EscherSpRecord.FLAG_FLIPVERT;
anchor = CreateAnchor(userAnchor);
clientData.RecordId=EscherClientDataRecord.RECORD_ID;
clientData.Options=(short)0x0000;
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spContainer;
}
示例14: CreateSpContainer
/// <summary>
/// Creates the lowerlevel escher records for this shape.
/// </summary>
/// <param name="hssfShape">The HSSF shape.</param>
/// <param name="shapeId">The shape id.</param>
/// <returns></returns>
private EscherContainerRecord CreateSpContainer(HSSFSimpleShape hssfShape, int shapeId)
{
HSSFShape shape = hssfShape;
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherRecord anchor = new EscherClientAnchorRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.RecordId=EscherContainerRecord.SP_CONTAINER;
spContainer.Options=(short)0x000F;
sp.RecordId=EscherSpRecord.RECORD_ID;
sp.Options=(short)((EscherAggregate.ST_LINE << 4) | 0x2);
sp.ShapeId=shapeId;
sp.Flags=EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE;
opt.RecordId=EscherOptRecord.RECORD_ID;
opt.AddEscherProperty(new EscherShapePathProperty(EscherProperties.GEOMETRY__SHAPEPATH, EscherShapePathProperty.COMPLEX));
opt.AddEscherProperty(new EscherBoolProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 1048592));
AddStandardOptions(shape, opt);
HSSFAnchor userAnchor = shape.Anchor;
if (userAnchor.IsHorizontallyFlipped)
sp.Flags=sp.Flags | EscherSpRecord.FLAG_FLIPHORIZ;
if (userAnchor.IsVerticallyFlipped)
sp.Flags=sp.Flags | EscherSpRecord.FLAG_FLIPVERT;
anchor = CreateAnchor(userAnchor);
clientData.RecordId=EscherClientDataRecord.RECORD_ID;
clientData.Options=((short)0x0000);
spContainer.AddChildRecord(sp);
spContainer.AddChildRecord(opt);
spContainer.AddChildRecord(anchor);
spContainer.AddChildRecord(clientData);
return spContainer;
}
示例15: TestRecordSize
public void TestRecordSize()
{
DrawingGroupRecord r = new DrawingGroupRecord();
Assert.AreEqual(4, r.RecordSize);
EscherSpRecord sp = new EscherSpRecord();
sp.RecordId = (EscherSpRecord.RECORD_ID);
sp.Options = ((short)0x1111);
sp.Flags = (-1);
sp.ShapeId = (-1);
EscherContainerRecord dggContainer = new EscherContainerRecord();
dggContainer.Options = ((short)0x000F);
dggContainer.RecordId = unchecked((short)0xF000);
dggContainer.AddChildRecord(sp);
r.AddEscherRecord(dggContainer);
Assert.AreEqual(28, r.RecordSize);
byte[] data = new byte[28];
int size = r.Serialize(0, data);
Assert.AreEqual("[EB, 00, 18, 00, 0F, 00, 00, F0, 10, 00, 00, 00, 11, 11, 0A, F0, 08, 00, 00, 00, FF, FF, FF, FF, FF, FF, FF, FF]", HexDump.ToHex(data));
Assert.AreEqual(28, size);
Assert.AreEqual(24, dggContainer.RecordSize);
r = new DrawingGroupRecord();
r.RawData = (new byte[MAX_DATA_SIZE]);
Assert.AreEqual(MAX_RECORD_SIZE, r.RecordSize);
r.RawData = (new byte[MAX_DATA_SIZE + 1]);
Assert.AreEqual(MAX_RECORD_SIZE + 5, r.RecordSize);
r.RawData = (new byte[MAX_DATA_SIZE * 2]);
Assert.AreEqual(MAX_RECORD_SIZE * 2, r.RecordSize);
r.RawData = (new byte[MAX_DATA_SIZE * 2 + 1]);
Assert.AreEqual(MAX_RECORD_SIZE * 2 + 5, r.RecordSize);
}