private static void LoadStyleSet() { XmlNamespaceManager m_XmlNamespaceManager = new XmlNamespaceManager(m_StyleXmlDocument.NameTable); m_XmlNamespaceManager.AddNamespace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); XmlElement m_XmlElement = m_StyleXmlDocument.DocumentElement; XmlNodeList StyleNodeList = m_XmlElement.SelectNodes("w:style", m_XmlNamespaceManager); foreach (XmlNode styleNode in StyleNodeList) { string TypeName = styleNode.Attributes["w:type"].InnerText.Trim(); string StyleID = styleNode.Attributes["w:styleId"].InnerText.Trim(); string StyleXml = styleNode.OuterXml; WordStyle ExistWordStyle = StyleSet.FirstOrDefault(p => p.TypeName == TypeName); if (ExistWordStyle == null) { WordStyle WordStyle = new WordStyle(); WordStyle.TypeName = TypeName; WordStyle.Styles.Add(StyleID, StyleXml); StyleSet.Add(WordStyle); } else { ExistWordStyle.Styles.Add(StyleID, StyleXml); } } }