One thing that people might be wondering how to do is how to access the XML relationship files (.rels files) using the Packaging API. For the OPC a relationship part is just another part in the package, and how do you retrieve a part from a package? Right, just call GetPart(Uri)
using (Package package = Package.Open("Sample.docx"))
{
PackagePart relationshipPart = package.GetPart(
new Uri("/_rels/.rels", UriKind.Relative));
}
You do not use a PackageRelationship here, because you are actually getting to the thing which defines PackageRelationship objects, so it is just a Uri based call. Usually you will not need to access the relationship XML. Mostly you'll want to access the thing pointed to by the relationship, and this is provided for in the Packaging API. One place where you will need to use this method is during validation of digital signatures in the package. Signature validation involves creating a canonical representation of the relationship file using a special transformation method (documented of course), hence the usefulness.
Hope it helps
Posted
29-01-2007 19:05
by
Anonymous