當前位置: 首頁>>代碼示例>>C#>>正文


C# Document.PrintOut方法代碼示例

本文整理匯總了C#中System.Windows.Forms.Document.PrintOut方法的典型用法代碼示例。如果您正苦於以下問題:C# Document.PrintOut方法的具體用法?C# Document.PrintOut怎麽用?C# Document.PrintOut使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.Document的用法示例。


在下文中一共展示了Document.PrintOut方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ImprimirEtiquetas

        public void ImprimirEtiquetas(String Titulo, String Modelo, String Gramos, String ID)
        {
            String sPath = "C:\\Users\\Adan Cervera\\Desktop\\TestGit\\TestGit\\POS.View\\VentasView\\CONTENEDORES.lbx";
            bpac.Document objDoc = new Document();
            objDoc = new Document();
            if (objDoc.Open(sPath) != null)
            {
                objDoc.GetObject("objTitulo").Text = Titulo;
                objDoc.GetObject("modelo").Text = Modelo;
                objDoc.GetObject("gramos").Text = Gramos;
                objDoc.GetObject("codebar").Text = ID.ToString() + '-' + Gramos;

                objDoc.StartPrint("", bpac.PrintOptionConstants.bpoDefault);
                objDoc.PrintOut(1, bpac.PrintOptionConstants.bpoDefault);
                objDoc.EndPrint();
                objDoc.Close();
            }
        }
開發者ID:Chepzalcoatl,項目名稱:TestGit,代碼行數:18,代碼來源:frmContenedoresList.cs

示例2: ImprimirEtiqueta

        private static void ImprimirEtiqueta(Int32 CodigoBarras, String Titulo, String Descripcion)
        {
            String sPath = "C:\\Users\\Adan Cervera\\Desktop\\TestGit\\TestGit\\POS.View\\VentasView\\RECARGAS.lbx";
            Document objDoc = new Document();
            objDoc = new Document();
            if (objDoc.Open(sPath) != null)
            {
                objDoc.GetObject("codebar").Text = CodigoBarras.ToString();
                objDoc.GetObject("modelo").Text = Titulo;
                objDoc.GetObject("marca").Text = Descripcion;

                objDoc.StartPrint("", bpac.PrintOptionConstants.bpoDefault);
                objDoc.PrintOut(1, bpac.PrintOptionConstants.bpoDefault);
                objDoc.EndPrint();
                objDoc.Close();
            }
        }
開發者ID:Chepzalcoatl,項目名稱:TestGit,代碼行數:17,代碼來源:frmPOS.cs

示例3: btnGenerateNewPWs_Click

        private void btnGenerateNewPWs_Click(object sender, EventArgs e)
        {
            //killprocess("winword");
            app = new Microsoft.Office.Interop.Word.Application { Visible = false };
            
            System.Data.DataTable dt = new System.Data.DataTable();
            string qry = "SELECT * FROM ibis_pw_userlist WHERE ibis_pw_userlist_active = 1 AND ibis_pw_userlist_id > 1";
            //string qry = "SELECT * FROM ibis_pw_userlist WHERE ibis_pw_userlist_active = 1";

            Random randnum = new Random();
            int _min4 = 0;
            int _max4 = 9999;
            int _min6 = 0;
            int _max6 = 999999;

            using (MySqlConnection dbh = new MySqlConnection(Properties.Resources.DB_CONNSTR_HES))
            {
                dbh.Open();
                using (MySqlDataAdapter da = new MySqlDataAdapter(qry, dbh))
                {
                    da.Fill(dt);

                    foreach (DataRow row in dt.Rows)
                    {
                        doc = app.Documents.Add(@"C:\Users\dc1_000\Documents\HoldenEngineering\pw_memo_template.docx");
                        doc.Activate();

                        string newpw;
                        if (row["ibis_pw_userlist_un"].ToString().Equals("dholden"))
                        {
                            newpw = String.Format("{0:000000}", randnum.Next(_min6, _max6));
                        }
                        else
                        {
                            // HERE IS WHERE ONE COULD RANDOMIZE THE PLACEMENT OF
                            // THE ABBREVIATION RELATIVE TO THE FOUR-DIGIT NUMBER

                            newpw = row["ibis_pw_userlist_abbr"].ToString() + String.Format("{0:0000}", randnum.Next(_min4, _max4));
                        }

                        doc.Bookmarks["bmNameLbl"].Range.Text = row["ibis_pw_userlist_label"].ToString();
                        doc.Bookmarks["bmGenPW"].Range.Text = newpw;
                        doc.Bookmarks["bmUserName"].Range.Text = row["ibis_pw_userlist_un"].ToString();
                        doc.Bookmarks["bmOldPW"].Range.Text = row["ibis_pw_userlist_currpw"].ToString();
                        doc.Bookmarks["bmNewPW"].Range.Text = newpw;
                        doc.Bookmarks["bmNewPW2"].Range.Text = newpw;

                        doc.PrintOut();
                        ((Microsoft.Office.Interop.Word._Document)doc).Close(false, ref missing, ref missing);

                        try
                        {
                            MySqlCommand cmd = new MySqlCommand();
                            cmd.Connection = dbh;

                            cmd.CommandText = "UPDATE ibis_pw_userlist SET ibis_pw_userlist_currpw = @npw, ibis_pw_userlist_prevpw = @opw WHERE ibis_pw_userlist_id = @uid";
                            cmd.Prepare();

                            cmd.Parameters.AddWithValue("@npw", newpw);
                            cmd.Parameters.AddWithValue("@opw", row["ibis_pw_userlist_currpw"].ToString());
                            cmd.Parameters.AddWithValue("@uid", row["ibis_pw_userlist_id"].ToString());

                            cmd.ExecuteNonQuery();
                        }
                        catch (MySqlException mysqle)
                        {
                            MessageBox.Show("mysql ERROR: " + mysqle.ToString());
                            return;
                        }
                        catch (Exception m1ex)
                        {
                            MessageBox.Show("M1_ERROR: " + m1ex.ToString());
                            return;
                        }
                    }
                }
                dbh.Close();
            }
        }
開發者ID:folnar,項目名稱:pw_gen,代碼行數:79,代碼來源:frmPWMemoMainMenu.cs

示例4: btnPrintPWMemos_Click

        private void btnPrintPWMemos_Click(object sender, EventArgs e)
        {
            app = new Microsoft.Office.Interop.Word.Application { Visible = false };

            System.Data.DataTable dt = new System.Data.DataTable();
            string qry = "SELECT * FROM ibis_pw_userlist WHERE ibis_pw_userlist_active = 1";

            using (MySqlConnection dbh = new MySqlConnection(Properties.Resources.DB_CONNSTR_HES))
            {
                dbh.Open();
                using (MySqlDataAdapter da = new MySqlDataAdapter(qry, dbh))
                {
                    da.Fill(dt);

                    foreach (DataRow row in dt.Rows)
                    {
                        doc = app.Documents.Add(@"C:\Users\dc1_000\Documents\HoldenEngineering\pw_memo_template.docx");
                        doc.Activate();

                        doc.Bookmarks["bmNameLbl"].Range.Text = row["ibis_pw_userlist_label"].ToString();
                        doc.Bookmarks["bmGenPW"].Range.Text = row["ibis_pw_userlist_currpw"].ToString();
                        doc.Bookmarks["bmUserName"].Range.Text = row["ibis_pw_userlist_un"].ToString();
                        doc.Bookmarks["bmOldPW"].Range.Text = row["ibis_pw_userlist_prevpw"].ToString();
                        doc.Bookmarks["bmNewPW"].Range.Text = row["ibis_pw_userlist_currpw"].ToString();
                        doc.Bookmarks["bmNewPW2"].Range.Text = row["ibis_pw_userlist_currpw"].ToString();

                        doc.PrintOut();
                        ((Microsoft.Office.Interop.Word._Document)doc).Close(false, ref missing, ref missing);
                    }
                }
                dbh.Close();
            }

        }
開發者ID:folnar,項目名稱:pw_gen,代碼行數:34,代碼來源:frmPWMemoMainMenu.cs


注:本文中的System.Windows.Forms.Document.PrintOut方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。