예제 #1
0
    private void combineButton_Click(object sender, EventArgs e)
    {
        string outputFileName = (@"C:\Test\Merge\Combined.docx");

        MsWord.Merge(_sourceFiles, outputFileName, true);
        // Message displaying how many files are combined.
        MessageBox.Show("A total of " + documentFolder.Length.ToString() + " documents have been merged", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
예제 #2
0
        /// <summary>
        /// Stop Microsoft Word
        /// </summary>
        public void StopMsWord()
        {
            if (MsWord != null)
            {
                MsWord.Quit();
                MsWord = null;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
예제 #3
0
 static void Main(string[] args)
 {
     try
     {
         string   document1        = @"D:\Visual Studio Projects\31.docx";
         string   document2        = @"D:\Visual Studio Projects\33.docx";
         string   document3        = @"D:\Visual Studio Projects\32.docx";
         string[] documentsToMerge = { document1, document2, document3 };
         string   outputFileName   = String.Format("D:\\Visual Studio Projects\\{0}.docx", Guid.NewGuid( ));
         MsWord.Merge(documentsToMerge, outputFileName, true);
     }
     catch (Exception ex)
     {
         //messageLabel.Text = ex.Message;
     }
 }
예제 #4
0
 public bool CreateLogFile(String applicationName, String version, String environment)
 {
     try
     {
         String resDocName = FeatureContext.Current.FeatureInfo.Title + "_" + "OELog";
         FeatureContext.Current.Add("OELog", resDocName);
         String reportsFolderPath = FeatureContext.Current["ReportsFolderPath"].ToString();
         MsWord word = new MsWord();
         word.CreateOELogFromTemplate(resDocName, reportsFolderPath, applicationName, version, environment);
         FeatureContext.Current.Add("TableCounter", 1);
         FeatureContext.Current.Add("OELog_TableList", new TableList());
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }