Join
Sign in
Search Options
Search Everything
Search Formats
Home
Blog
Resources
Forums
About Open XML
More ...
Home
»
Forums
»
Formats
»
PresentationML
»
Updating slide r:Id relatationship to Master
Re: Updating slide r:Id relatationship to Master
Formats
Discussions about working with different Open XML Formats
Get this RSS feed
Details
1
Reply
1
Subscriber
Posted
over 2 years ago
Options
Subscribe via RSS
Share this
PresentationML
Updating slide r:Id relatationship to Master
rated by 0 users
This post has
1 Reply |
1
Follower
corker
20
Posted by
corker
on
Wed, Feb 24 2010 4:30 AM
rated by 0 users
Post Points: 20
Updating slide r:Id relatationship to Master
Hi, I am working with OpenXML SDK 1.0 (as 2.0 isn't licenced yet) in C#, and I have managed to merge 2 presentations together ok.
The one problem I have is that it says "PowerPoint has found unreadable content" when opening. Having looked through the XML files, the only problem I have found is the r:ID in my copied slide to its master slide is still the old/original presentations r:Id not the copied over Master.
Can anyone point me in the direction of how I update this relationship?
Ankush Bhatia
490
Posted by
Ankush Bhatia
on
Mon, Mar 1 2010 3:10 PM
rated by 0 users
Post Points: 5
Re: Updating slide r:Id relatationship to Master
Hi Corker,
Basically get the rID and then update it accordingly.
To summarize:
Get the Releationship id you want to use
Open the XML file where you need to replace the new ID with the old one.
Ex:
Something like
//Get the Slide Master releationshipid generated in Presentation.xml.rels
string releationshipId = pptMain.GetIdOfPart(pptSlideMaster);
// Replace the Slide Master releationshipid in the presentation.xml document so that presentation.xml and Presentation.xml.rels should match
XmlNamespaceManager nsManager = new XmlNamespaceManager(xDoc.NameTable);
nsManager.AddNamespace("p", xDoc.DocumentElement.NamespaceURI);
XmlNodeList nodelist = xDoc.SelectNodes("//p:sldMasterIdLst/p:sldMasterId", nsManager);
foreach (XmlNode node in nodelist)
{
node.Attributes["r:id"].Value = releationshipId;
}
HTH
Ankush
Page 1 of 1 (2 items)