⇤ ← Revision 1 as of 2021-06-02 06:07:39
Size: 692
Comment:
|
Size: 716
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 7: | Line 7: |
}}} |
|
Line 8: | Line 10: |
{{{#!highlight c# |
You can convert a given OpenXmlElement to a XElement using the following code:
To convert an XElement to an OpenXmlElement try the following code:
1 XElement xe = ...;
2 using(StreamWriter sw = new StreamWriter(new MemoryStream()))
3 {
4 sw.Write(xe.ToString());
5 sw.Flush();
6 sw.BaseStream.Seek(0, SeekOrigin.Begin);
7
8 OpenXmlReader re = OpenXmlReader.Create(sw.BaseStream);
9
10 re.Read();
11 OpenXmlElement oxe = re.LoadCurrentElement();
12 re.Close();
13 }
14 Hope, this helps.