Size: 692
Comment:
|
Size: 718
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
You can convert a given OpenXmlElement to a XElement using the following code: | You can convert a given !OpenXmlElement to a XElement using the following code: |
Line 7: | Line 7: |
To convert an XElement to an OpenXmlElement try the following code: | }}} |
Line 9: | Line 9: |
To convert an XElement to an !OpenXmlElement try the following code: {{{#!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.