简体   繁体   中英

How to print word document after edit it

i need to know how to print word file from windows form application after edit it

i used this cod to save my document

    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);

            }

after save my document i need to print it what i can do ??

One option is to launch the file with the Print Verb. For example:

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

The other option is to use the Office SDK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM