C# 编辑word文档后如何打印文档
我需要知道如何打印word文件从windows窗体应用程序后编辑它 我用这个cod来保存我的文件C# 编辑word文档后如何打印文档,c#,winforms,desktop-application,C#,Winforms,Desktop Application,我需要知道如何打印word文件从windows窗体应用程序后编辑它 我用这个cod来保存我的文件 DialogResult = MessageBox.Show("This message to confirm the data", "Data Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (DialogResult == DialogResult.OK) {
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);
}
保存文档后,我需要打印它
我能做什么 一个选项是使用打印谓词启动文件。例如:
ProcessStartInfo info = new ProcessStartInfo(saveFileDialog1.FileName);
info.Verb = "Print";
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(info);
另一个选项是使用Office SDK。工作正常,但它显示了“我的word”中的一页,并在一个便笺中打开。听起来您的默认打印机设置为“OneNote”。将默认打印机更改为真正的打印机。从真正的打印机打印时,将打印所有页面