本文整理汇总了C#中NPOI.OpenXml4Net.OPC.OPCPackage.GetParts方法的典型用法代码示例。如果您正苦于以下问题:C# OPCPackage.GetParts方法的具体用法?C# OPCPackage.GetParts怎么用?C# OPCPackage.GetParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI.OpenXml4Net.OPC.OPCPackage
的用法示例。
在下文中一共展示了OPCPackage.GetParts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertReadWrite
public void AssertReadWrite(OPCPackage pkg1)
{
OPCParser doc = new OPCParser(pkg1);
doc.Parse(new TestFactory());
Dictionary<String, POIXMLDocumentPart> context = new Dictionary<String, POIXMLDocumentPart>();
Traverse(doc, context);
context.Clear();
string tmp = TempFile.GetTempFilePath("poi-ooxml", ".tmp");
FileStream out1 = new FileStream(tmp, FileMode.CreateNew);
doc.Write(out1);
out1.Close();
OPCPackage pkg2 = OPCPackage.Open(tmp);
doc = new OPCParser(pkg1);
doc.Parse(new TestFactory());
context = new Dictionary<String, POIXMLDocumentPart>();
Traverse(doc, context);
context.Clear();
Assert.AreEqual(pkg1.Relationships.Size, pkg2.Relationships.Size);
List<PackagePart> l1 = pkg1.GetParts();
List<PackagePart> l2 = pkg2.GetParts();
Assert.AreEqual(l1.Count, l2.Count);
for (int i = 0; i < l1.Count; i++)
{
PackagePart p1 = l1[i];
PackagePart p2 = l2[i];
Assert.AreEqual(p1.ContentType, p2.ContentType);
Assert.AreEqual(p1.HasRelationships, p2.HasRelationships);
if (p1.HasRelationships)
{
Assert.AreEqual(p1.Relationships.Size, p2.Relationships.Size);
}
Assert.AreEqual(p1.PartName, p2.PartName);
}
}