当前位置: 首页>>代码示例>>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;未经允许,请勿转载。