public static void StartExportOneNotePages(string profilename, KonfigurationOneNote onenoteConf) { oneNote = new Application(); String oneNoteBooksC; Application onApplication = new Application(); onApplication.GetHierarchy(null, HierarchyScope.hsPages, out oneNoteBooksC); XmlDocument oneNoteBooksXml = new XmlDocument(); oneNoteBooksXml.LoadXml(oneNoteBooksC); string strNamespace = "http://schemas.microsoft.com/office/onenote/2013/onenote"; XmlNamespaceManager nsmgr = new XmlNamespaceManager(oneNoteBooksXml.NameTable); nsmgr.AddNamespace("one", strNamespace); XmlNode xmlOneNoteBook = oneNoteBooksXml.SelectSingleNode("//one:Notebook[@name='" + onenoteConf.notebook + "']", nsmgr); OneNoteBook book = new OneNoteBook(xmlOneNoteBook, onenoteConf); book.saveOneNoteBook(onenoteConf); book.saveOneNoteBookCfg(onenoteConf); Debug.WriteLine("Done."); }
public Section(XmlNode node, OneNoteBook book, KonfigurationOneNote onenoteConf) { this.book = book; this.node = node; if (node.Attributes != null && node.Attributes["ID"] != null) { id = node.Attributes["ID"].InnerText; } if (node.Attributes != null && node.Attributes["name"] != null) { name = node.Attributes["name"].InnerText; } addPages(onenoteConf); }
ContentImage thumbnail = null; // thumbnail image public Page(XmlDocument node, String id, OneNoteBook book, KonfigurationOneNote onenoteConf) { this.book = book; this.node = node; this.id = id; // generate Page link String link; ExportOneNotePages.oneNote.GetHyperlinkToObject(this.id, null, out link); this.linkPageId = getLinkPageId(link); string strNamespace = "http://schemas.microsoft.com/office/onenote/2013/onenote"; XmlNamespaceManager nsmgr = new XmlNamespaceManager(node.NameTable); nsmgr.AddNamespace("one", strNamespace); XmlNode pageNode = node.SelectSingleNode("//one:Page", nsmgr); if (pageNode.Attributes != null && pageNode.Attributes["name"] != null) { name = pageNode.Attributes["name"].InnerText; } // read quickstyle definitions XmlNodeList quickStyleNodes = node.SelectNodes("//one:QuickStyleDef", nsmgr); foreach (XmlNode quickStyleNode in quickStyleNodes) { if (quickStyleNode.Attributes["index"] != null && quickStyleNode.Attributes["name"] != null) { styles.Add(quickStyleNode.Attributes["index"].InnerText, quickStyleNode.Attributes["name"].InnerText); } } // read tag definitions XmlNodeList tagDefNodes = node.SelectNodes("//one:TagDef", nsmgr); foreach (XmlNode tagDefNode in tagDefNodes) { if (tagDefNode.Attributes["index"] != null && tagDefNode.Attributes["name"] != null) { tagDef.Add(tagDefNode.Attributes["index"].InnerText, tagDefNode.Attributes["name"].InnerText); } } // read tags XmlNodeList tagNodes = node.SelectNodes("//one:Tag", nsmgr); foreach (XmlNode tagNode in tagNodes) { if (tagNode.Attributes["index"] != null) { String name = tagDef[tagNode.Attributes["index"].InnerText]; if (name != null) { tags.Add(name); } } } // read paragraphs XmlNodeList oeNodes = node.SelectNodes("//one:OE", nsmgr); foreach (XmlNode oeNode in oeNodes) { if (!this.ignoreNodeIfNameInParents(oeNode, "one:Table") && !this.ignoreNodeIfNameInParents(oeNode, "one:Title")) { paragraphs.Add(new Paragraph(this, oeNode, onenoteConf)); } } }