开发者

OpenXML SDK: Updated text in HeaderPart not getting saved

开发者 https://www.devze.com 2023-01-08 08:22 出处:网络
elem is obtained by searching various document parts, both MainDocumentPart.Document and HeaderParts:

elem is obtained by searching various document parts, both MainDocumentPart.Document and HeaderParts:

                Text text =开发者_开发技巧 elem.GetFirstChild<Text>();
                System.Console.Write("Updating content from '{0}'", text.Text);
                text.Text = "blah";
                System.Console.WriteLine(" to '{0}'", text.Text);

In all cases the output is exactly as expected to stdout, it looks to work perfectly. But when the file is saved, only changes to the main body text are seen... the header remains unchanged. Do I have to unlock the header or something?


Call HeaderPart.Header.Save() on the Header that contains elem.

0

精彩评论

暂无评论...
验证码 换一张
取 消