I am accessing footer and making changes to it. Problem is when saving the changes back. I have tried using:
XmlDocument xdoc = new XmlDocument("http://schemas.openxmlformats.org/wordprocessingml/2006/main");
where wdDoc is WordprocessingDocument instance.
Can this be done this way somehow? Or do I need to remove current footer and references to it and then create new footer and references out of what I have?
Thanks for any help and hints on how to handle this.
ps. hello everyone, as this is my first post ;)
I'm not sure of the answer since I don't know how you are making changes. I prefer to create an XDocument object to make modifications and then write the modified XDocument when I am done. If you are using the new strongly typed elements in 2.0, then I am not as sure of the functionality. If you get the Footer object from the FooterPart and modify it, I think the changes might be complete. Otherwise, try footerPart.Save(footer).
Thanks for advice bobm. I achieved what I needed this way: I changed footer using XDocument object. Then, I removed old footer and references to it in main document part using Package class and created new footer part using PackagePart class. Then, I saved new footer using XDocument.