wordpress hit counter
Re: Updating slide r:Id relatationship to Master - PresentationML - Formats - OpenXML Developer

Re: Updating slide r:Id relatationship to Master

Formats

Discussions about working with different Open XML Formats

Updating slide r:Id relatationship to Master

  • rated by 0 users
  • This post has 1 Reply |
  • 1 Follower
  • 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?
  • 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)