2014-10-05 70 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