static void Main(string[] args) { string connectionToChange = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MOIN_MSCRM;Data Source=crm11moin"; // "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MANTA_MSCRM;Data Source=CRM11MANTAD"; var queryToChange = "select top 1 new_name as name from new_provider;"; var pathTarget = @"C:\Users\lior_g\Documents\GitHub\DocMailMerge\TemplatesWords\output2.docx"; var pathSource = "http://localhost/TemplatesWords/name.docx"; var mailMergeOpenXml = new MailMergeOpenXml(Log); pathSource = "http://*****:*****@"c:\temp\tal.docm"; var source = new SourceWebDoc(pathSource); var target = new TargetLocalDoc(pathTarget); mailMergeOpenXml.FillData(source, target); return; var customProperties = new Dictionary <string, string>(); customProperties.Add("server", ""); customProperties.Add("entityid", Guid.NewGuid().ToString()); customProperties.Add("tempfolder", "c:\\temp\r.udl"); var result = mailMergeOpenXml.Merge(connectionToChange, queryToChange, source, target, @"c:\\temp\r.udl", @"c:\\temp\TemplateCrmMenta.dotm", customProperties); }
private void btnDisconnect_Click(object sender, EventArgs e) { if (lstFiles.SelectedItems != null && lstFiles.SelectedItems.Count > 0) { String fileName = lstFiles.SelectedItems[0].Text.ToString(); var pathTarget = TargetFolder + @"\" + fileName; Log("pathTarget=" + pathTarget, EventLogEntryType.Information); var pathSource = SourceUri + "/" + fileName; Log("pathSource=" + pathSource, EventLogEntryType.Information); if (File.Exists(pathTarget)) { Log("pathTarget is deleted" + pathTarget, EventLogEntryType.Information); File.Delete(pathTarget); } var mailMergeOpenXml = new MailMergeOpenXml(Log); var source = new SourceWebDoc(pathSource); var target = new TargetLocalDoc(pathTarget); mailMergeOpenXml.FillData(source, target); Log("done disconnect", EventLogEntryType.Information); } }