我需要知道如何在编辑后从Windows窗体应用程序打印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 :(得分:0)
一个选项是使用Print Verb启动文件。例如:
ProcessStartInfo info = new ProcessStartInfo(saveFileDialog1.FileName);
info.Verb = "Print";
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(info);
另一种选择是使用Office SDK。