2014-10-05 71 views
0

我需要知道如何打印從Windows窗體應用程序Word文件編輯後如何編輯後打印Word文檔就

我用這個鱈魚保存在我的文檔

DialogResult = MessageBox.Show("This message to confirm the data", "Data Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); 
     if (DialogResult == DialogResult.OK) 
     { 
      pictureBox1.Visible = true; 

      string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); 
      string pathTwo = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); 
      saveFileDialog1.FileName = "MMVA" + "(" + txt_Vname.Text + ")" + CustomFormatsave() + ".docx"; 
      saveFileDialog1.DefaultExt = ".docx"; 
      saveFileDialog1.InitialDirectory = @"C:\"; 
      saveFileDialog1.CheckFileExists = false; 
      saveFileDialog1.CheckPathExists = true; 

      // saveFileDialog1.ShowDialog(); 
      DialogResult result = saveFileDialog1.ShowDialog(); 

      if (result == DialogResult.OK) 
      { 
       CreateWordDocument(pathTwo + @"\MMVA Template .docx", saveFileDialog1.FileName); 

      } 

保存在我的文檔後,我需要打印它 我能做什麼?

回答

0

一種選擇是使用Print Verb啓動文件。例如:

ProcessStartInfo info = new ProcessStartInfo(saveFileDialog1.FileName); 
info.Verb = "Print"; 
info.CreateNoWindow = true; 
info.WindowStyle = ProcessWindowStyle.Hidden; 
Process.Start(info); 

另一種選擇是使用Office SDK。

+0

工作,但它顯示了我的單詞的一個頁面,它打開在一個音符 – 2014-10-05 18:47:50

+0

這聽起來像您的默認打印機設置爲'OneNote'。將您的默認打印機更改爲真實的打印機。 – Donal 2014-10-05 18:58:30

+0

好的,關於頁數 – 2014-10-05 19:00:27