/// <summary> /// Creates an instance of the class /// </summary> public COMAddin() { Factory = RaiseCreateFactory(); if (null == Factory) Factory = Core.Default; TaskPanes = new CustomTaskPaneCollection(); TaskPaneInstances = new List<ITaskPane>(); Type = this.GetType(); }
/// <summary> /// Creates an instance of the class /// </summary> public COMAddin() { try { TaskPanes = new CustomTaskPaneCollection(); TaskPaneInstances = new List<ITaskPane>(); Type = this.GetType(); } catch (NetRunTimeSystem.Exception exception) { NetOffice.DebugConsole.WriteException(exception); bool handled = false; RaiseErrorHandlerMethod(exception, ref handled); if(!handled) throw exception; } }
private void LoadSampleCustomerData() { _customers = new List<Customer>(); string embeddedCustomerXmlContent = ReadString("SampleData.CustomerData.xml"); XmlDocument document = new XmlDocument(); document.LoadXml(embeddedCustomerXmlContent); foreach (XmlNode customerNode in document.DocumentElement.ChildNodes) { int id = Convert.ToInt32(customerNode.Attributes["ID"].Value); string name = customerNode.Attributes["Name"].Value; string company = customerNode.Attributes["Company"].Value; string city = customerNode.Attributes["City"].Value; string postalCode = customerNode.Attributes["PostalCode"].Value; string country = customerNode.Attributes["Country"].Value; string phone = customerNode.Attributes["Phone"].Value; _customers.Add(new Customer(id, name, company, city, postalCode, country, phone)); } }
public static void ProcessFiles(IEnumerable<string> files) { var docFiles = new List<string>(); var xlsFiles = new List<string>(); var pptFiles = new List<string>(); foreach (var file in files) { var extName = Path.GetExtension(file); switch (extName) { case ".doc": docFiles.Add(file); break; case ".xls": xlsFiles.Add(file); break; case ".ppt": pptFiles.Add(file); break; } } }
public static void Merge(List<string> filesToMerge) { // Make a Word selection object. _Word.Selection selection = wordApplication.Selection; // Loop through each of the Word documents foreach (string file in filesToMerge) { // Insert the files to our template // selection.InsertNewPage(); selection.InsertFile(file); } }
public List<string> Read() { var result = new List<string>(); foreach (Word.Paragraph p in document.Paragraphs) { result.Add(p.Range.Text); } return result; }