本文整理汇总了C#中NPOI.DDF.EscherContainerRecord.GetChildById方法的典型用法代码示例。如果您正苦于以下问题:C# EscherContainerRecord.GetChildById方法的具体用法?C# EscherContainerRecord.GetChildById怎么用?C# EscherContainerRecord.GetChildById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI.DDF.EscherContainerRecord
的用法示例。
在下文中一共展示了EscherContainerRecord.GetChildById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: 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);
}
示例3: CreateShapeTree
/**
* build shape tree from escher container
* @param container root escher container from which escher records must be taken
* @param agg - EscherAggregate
* @param out - shape container to which shapes must be added
* @param root - node to create HSSFObjectData shapes
*/
public static void CreateShapeTree(EscherContainerRecord container, EscherAggregate agg,
HSSFShapeContainer out1, DirectoryNode root)
{
if (container.RecordId == EscherContainerRecord.SPGR_CONTAINER)
{
ObjRecord obj = null;
EscherClientDataRecord clientData = (EscherClientDataRecord)((EscherContainerRecord)container.GetChild(0)).GetChildById(EscherClientDataRecord.RECORD_ID);
if (null != clientData)
{
obj = (ObjRecord)agg.GetShapeToObjMapping()[clientData];
}
HSSFShapeGroup group = new HSSFShapeGroup(container, obj);
IList<EscherContainerRecord> children = container.ChildContainers;
// skip the first child record, it is group descriptor
for (int i = 0; i < children.Count; i++)
{
EscherContainerRecord spContainer = children[(i)];
if (i != 0)
{
CreateShapeTree(spContainer, agg, group, root);
}
}
out1.AddShape(group);
}
else if (container.RecordId == EscherContainerRecord.SP_CONTAINER)
{
Dictionary<EscherRecord, Record.Record> shapeToObj = agg.GetShapeToObjMapping();
ObjRecord objRecord = null;
TextObjectRecord txtRecord = null;
foreach (EscherRecord record in container.ChildRecords)
{
switch (record.RecordId)
{
case EscherClientDataRecord.RECORD_ID:
objRecord = (ObjRecord)shapeToObj[(record)];
break;
case EscherTextboxRecord.RECORD_ID:
txtRecord = (TextObjectRecord)shapeToObj[(record)];
break;
}
}
if (IsEmbeddedObject(objRecord))
{
HSSFObjectData objectData = new HSSFObjectData(container, objRecord, root);
out1.AddShape(objectData);
return;
}
CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)objRecord.SubRecords[0];
HSSFShape shape;
switch (cmo.ObjectType)
{
case CommonObjectType.Picture:
shape = new HSSFPicture(container, objRecord);
break;
case CommonObjectType.Rectangle:
shape = new HSSFSimpleShape(container, objRecord, txtRecord);
break;
case CommonObjectType.Line:
shape = new HSSFSimpleShape(container, objRecord);
break;
case CommonObjectType.ComboBox:
shape = new HSSFCombobox(container, objRecord);
break;
case CommonObjectType.MicrosoftOfficeDrawing:
EscherOptRecord optRecord = (EscherOptRecord)container.GetChildById(EscherOptRecord.RECORD_ID);
EscherProperty property = optRecord.Lookup(EscherProperties.GEOMETRY__VERTICES);
if (null != property)
{
shape = new HSSFPolygon(container, objRecord, txtRecord);
}
else
{
shape = new HSSFSimpleShape(container, objRecord, txtRecord);
}
break;
case CommonObjectType.Text:
shape = new HSSFTextbox(container, objRecord, txtRecord);
break;
case CommonObjectType.Comment:
shape = new HSSFComment(container, objRecord, txtRecord, agg.GetNoteRecordByObj(objRecord));
break;
default:
shape = new HSSFSimpleShape(container, objRecord, txtRecord);
break;
}
out1.AddShape(shape);
}
}