示例#1
0
        public void Run(clsDATAinfo item, string prc_folderpath)
        {
            savepath     = prc_folderpath;
            punblic_item = item;


            List <clsDATAinfo> List = new List <clsDATAinfo>();

            List.Add(item);


            LocalReport report = new LocalReport();

            report.ReportPath = System.Windows.Forms.Application.StartupPath + "\\Report1.rdlc";

            report.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", List));

            Export(report);
            m_currentPageIndex = 0;


            Print(orderprint, 0, 0);

            //导出 word

            //   btnExportExcel_Click(report);
            //好用 但是 图片不能叠加的现实
            //btnExportword(report);
        }
示例#2
0
        private void newButton_Click(object sender, EventArgs e)
        {
            clsDATAinfo item = new clsDATAinfo();

            item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
            item.xinzeng    = "true";

            this.bindingSource1.Add(item);
            this.dataGridView1.Refresh();
        }
示例#3
0
        private clsDATAinfo GetSelectedSchedule()
        {
            clsDATAinfo schedule = null;
            var         row      = this.dataGridView1.CurrentRow;

            if (row != null)
            {
                schedule = row.DataBoundItem as clsDATAinfo;
            }
            return(schedule);
        }
示例#4
0
        public string sql_yuju(DoWorkEventArgs e, clsDATAinfo item, string conditions)
        {
            if (item.zhenghao != null)
            {
                conditions += " zhenghao ='" + item.zhenghao + "'";
            }
            if (item.xingming != null)
            {
                conditions += " ,xingming ='" + item.xingming + "'";
            }
            if (item.xingbie != null)
            {
                conditions += " ,xingbie ='" + item.xingbie + "'";
            }
            if (item.zuoyeleibie != null)
            {
                conditions += " ,zuoyeleibie ='" + item.zuoyeleibie + "'";
            }
            if (item.zhuncaoxiangmu != null)
            {
                conditions += " ,zhuncaoxiangmu ='" + item.zhuncaoxiangmu + "'";
            }
            if (item.chulingriqi != null)
            {
                conditions += " ,chulingriqi ='" + item.chulingriqi + "'";
            }
            if (item.youxiangqixian != null)
            {
                conditions += " ,youxiangqixian ='" + item.youxiangqixian + "'";
            }
            if (item.fushenriqi != null)
            {
                conditions += " ,fushenriqi ='" + item.fushenriqi + "'";
            }

            if (item.Message != null)
            {
                conditions += " ,Message ='" + item.Message + "'";
            }
            if (item.Input_Date != null)
            {
                conditions += " ,Input_Date ='" + item.Input_Date.ToString("yyyy/MM/dd") + "'";
            }
            if (item.xinzeng == "true")
            {
                conditions = "insert into PeopleData(zhenghao,xingming,xingbie,zuoyeleibie,zhuncaoxiangmu,chulingriqi,youxiangqixian,fushenriqi,Input_Date,Message) values ('" + item.zhenghao + "','" + item.xingming + "','" + item.xingbie + "','" + item.zuoyeleibie + "','" + item.zhuncaoxiangmu + "','" + item.chulingriqi + "','" + item.youxiangqixian + "','" + item.fushenriqi + "','" + item.Input_Date.ToString("yyyy/MM/dd") + "','" + item.Message + "')";
            }
            else
            {
                conditions = "update PeopleData set  " + conditions + " where Item_ID = " + item.Item_ID + " ";
            }

            return(conditions);
        }
示例#5
0
        public int update_Server(string findtext, clsDATAinfo item)
        {
            if (findtext.Contains("insert into"))
            {
                string sql2 = "delete from PeopleData where  zhenghao='" + item.zhenghao + "'" + "And xingming='" + item.xingming + "'";

                int isrun1 = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.CONNECTION_STRING_BASE, sql2, CommandType.Text, null);
            }
            int isrun = SQLiteHelper.ExecuteNonQuery(SQLiteHelper.CONNECTION_STRING_BASE, findtext, CommandType.Text, null);

            return(isrun);
        }
示例#6
0
        //将图片保存在流中
        public void InitImage(clsDATAinfo temp)
        {
            string yinzhangweizhi = AppDomain.CurrentDomain.BaseDirectory + "Resources\\seal\\" + temp.Message + ".gif";//02.gif
            string ZFCEPath       = AppDomain.CurrentDomain.BaseDirectory + "Resources\\photo\\" + temp.xingming + ".jpg";

            //Bitmap right = new Bitmap(Server.MapPath("../Images/right.jpeg"));
            //Bitmap wrong = new Bitmap(Server.MapPath("../Images/wrong.jpeg"));
            Bitmap right = new Bitmap(yinzhangweizhi);
            Bitmap wrong = new Bitmap(ZFCEPath);

            bufferRight = BitmapToBytes(right);
            bufferWrong = BitmapToBytes(wrong);
        }
示例#7
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            try
            {
                #region 获取信息
                Orderinfolist_Server = new List <clsDATAinfo>();

                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    if ((bool)dataGridView1.Rows[i].Cells[1].EditedFormattedValue == true)
                    {
                        clsDATAinfo item = new clsDATAinfo();
                        item.zhenghao = Convert.ToString(dataGridView1.Rows[i].Cells["zhenghao"].EditedFormattedValue.ToString());

                        item.xingming = Convert.ToString(dataGridView1.Rows[i].Cells["xingming"].EditedFormattedValue.ToString());

                        item.xingbie = Convert.ToString(dataGridView1.Rows[i].Cells["xingbie"].EditedFormattedValue.ToString());

                        item.zuoyeleibie = Convert.ToString(dataGridView1.Rows[i].Cells["zuoyeleibie"].EditedFormattedValue.ToString());

                        item.zhuncaoxiangmu = Convert.ToString(dataGridView1.Rows[i].Cells["zhuncaoxiangmu"].EditedFormattedValue.ToString());

                        item.chulingriqi = Convert.ToString(dataGridView1.Rows[i].Cells["chulingriqi"].EditedFormattedValue.ToString());

                        item.youxiangqixian = Convert.ToString(dataGridView1.Rows[i].Cells["youxiangqixian"].EditedFormattedValue.ToString());

                        item.fushenriqi = Convert.ToString(dataGridView1.Rows[i].Cells["fushenriqi"].EditedFormattedValue.ToString());
                        item.Message    = Convert.ToString(dataGridView1.Rows[i].Cells["Message"].EditedFormattedValue.ToString());



                        Orderinfolist_Server.Add(item);
                    }
                }
                if (Orderinfolist_Server == null || Orderinfolist_Server.Count == 0)
                {
                    MessageBox.Show("请选择要制证的信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                #endregion
                InitialBackGroundWorker();
                bgWorker.DoWork += new DoWorkEventHandler(PrintView_List);

                bgWorker.RunWorkerAsync();
                // 启动消息显示画面
                frmMessageShow = new frmMessageShow(clsShowMessage.MSG_001,
                                                    clsShowMessage.MSG_007,
                                                    clsConstant.Dialog_Status_Disable);
                frmMessageShow.ShowDialog();
                // 数据读取成功后在画面显示
                if (blnBackGroundWorkIsOK)
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("12320" + ex);
                return;

                throw ex;
            }
        }
示例#8
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            prc_folderpath = "";

            FolderBrowserDialog dialog = new FolderBrowserDialog();

            dialog.Description = "请选择文件夹路径";


            if (dialog.ShowDialog() == DialogResult.OK)
            {
                this.toolStripLabel1.Text = dialog.SelectedPath;
                prc_folderpath            = dialog.SelectedPath;;
            }
            if (prc_folderpath == null || prc_folderpath == "")
            {
                return;
            }
            //if (MessageBox.Show("是否继续上传 ?", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            //{
            //}
            //else
            //    return;


            try
            {
                #region 获取信息
                Orderinfolist_Server = new List <clsDATAinfo>();

                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    if ((bool)dataGridView1.Rows[i].Cells[1].EditedFormattedValue == true)
                    {
                        clsDATAinfo item = new clsDATAinfo();
                        item.zhenghao = Convert.ToString(dataGridView1.Rows[i].Cells["zhenghao"].EditedFormattedValue.ToString());

                        item.xingming = Convert.ToString(dataGridView1.Rows[i].Cells["xingming"].EditedFormattedValue.ToString());

                        item.xingbie = Convert.ToString(dataGridView1.Rows[i].Cells["xingbie"].EditedFormattedValue.ToString());

                        item.zuoyeleibie = Convert.ToString(dataGridView1.Rows[i].Cells["zuoyeleibie"].EditedFormattedValue.ToString());

                        item.zhuncaoxiangmu = Convert.ToString(dataGridView1.Rows[i].Cells["zhuncaoxiangmu"].EditedFormattedValue.ToString());

                        item.chulingriqi = Convert.ToString(dataGridView1.Rows[i].Cells["chulingriqi"].EditedFormattedValue.ToString());

                        item.youxiangqixian = Convert.ToString(dataGridView1.Rows[i].Cells["youxiangqixian"].EditedFormattedValue.ToString());

                        item.fushenriqi = Convert.ToString(dataGridView1.Rows[i].Cells["fushenriqi"].EditedFormattedValue.ToString());
                        item.Message    = Convert.ToString(dataGridView1.Rows[i].Cells["Message"].EditedFormattedValue.ToString());



                        Orderinfolist_Server.Add(item);
                    }
                }
                if (Orderinfolist_Server == null || Orderinfolist_Server.Count == 0)
                {
                    MessageBox.Show("请选择要制证的信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                #endregion
                InitialBackGroundWorker();
                bgWorker.DoWork += new DoWorkEventHandler(CheckCaseList);

                bgWorker.RunWorkerAsync();
                // 启动消息显示画面
                frmMessageShow = new frmMessageShow(clsShowMessage.MSG_001,
                                                    clsShowMessage.MSG_007,
                                                    clsConstant.Dialog_Status_Disable);
                frmMessageShow.ShowDialog();
                // 数据读取成功后在画面显示
                if (blnBackGroundWorkIsOK)
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("12320" + ex);
                return;

                throw ex;
            }
        }
示例#9
0
        private bool dailysaveList(BackgroundWorker worker, DoWorkEventArgs e)
        {
            WorkerArgument arg          = e.Argument as WorkerArgument;
            clsAllnew      BusinessHelp = new clsAllnew();
            bool           success      = true;

            try
            {
                int rowCount = changeindex.Count;
                arg.OrderCount = rowCount;
                int j        = 1;
                int progress = 0;
                #region MyRegion
                for (int ik = 0; ik < changeindex.Count; ik++)
                {
                    j = ik;

                    arg.CurrentIndex = j + 1;
                    progress         = Convert.ToInt16(((j + 1) * 1.0 / rowCount) * 100);

                    int i   = changeindex[ik];
                    var row = dataGridView1.Rows[i];

                    var model = row.DataBoundItem as clsDATAinfo;

                    clsDATAinfo item = new clsDATAinfo();

                    item.zhenghao = Convert.ToString(dataGridView1.Rows[i].Cells["zhenghao"].EditedFormattedValue.ToString());

                    item.xingming = Convert.ToString(dataGridView1.Rows[i].Cells["xingming"].EditedFormattedValue.ToString());

                    item.xingbie = Convert.ToString(dataGridView1.Rows[i].Cells["xingbie"].EditedFormattedValue.ToString());

                    item.zuoyeleibie = Convert.ToString(dataGridView1.Rows[i].Cells["zuoyeleibie"].EditedFormattedValue.ToString());

                    item.zhuncaoxiangmu = Convert.ToString(dataGridView1.Rows[i].Cells["zhuncaoxiangmu"].EditedFormattedValue.ToString());

                    item.chulingriqi = Convert.ToString(dataGridView1.Rows[i].Cells["chulingriqi"].EditedFormattedValue.ToString());

                    item.youxiangqixian = Convert.ToString(dataGridView1.Rows[i].Cells["youxiangqixian"].EditedFormattedValue.ToString());

                    item.fushenriqi = Convert.ToString(dataGridView1.Rows[i].Cells["fushenriqi"].EditedFormattedValue.ToString());


                    item.xinzeng = Convert.ToString(dataGridView1.Rows[i].Cells["xinzeng"].EditedFormattedValue.ToString());
                    item.Message = Convert.ToString(dataGridView1.Rows[i].Cells["Message"].EditedFormattedValue.ToString());//印章类型

                    item.Input_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                    item.Item_ID    = model.Item_ID;

                    #endregion

                    #region MyRegion
                    var startAt = this.stockOutDateTimePicker.Value.AddDays(0).Date;
                    #region  构造查询条件
                    string conditions = "";
                    conditions = BusinessHelp.sql_yuju(e, item, conditions);
                    #endregion
                    #endregion

                    int isrun = BusinessHelp.update_Server(conditions, item);
                    if (item.xinzeng == "true" && isrun == 1)
                    {
                        item.xinzeng = "";
                    }

                    if (arg.CurrentIndex % 5 == 0)
                    {
                        backgroundWorker2.ReportProgress(progress, arg);
                    }
                }
                backgroundWorker2.ReportProgress(100, arg);
                e.Result = string.Format("{0} 已保存 !", changeindex.Count);
            }
            catch (Exception ex)
            {
                if (!e.Cancel)
                {
                    e.Result = ex.Message + "";
                }
                success = false;
            }

            return(success);
        }
示例#10
0
        public List <clsDATAinfo> Read_Excel(string Alist)
        {
            List <clsDATAinfo> MAPPINGResult = new List <clsDATAinfo>();

            try
            {
                System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
                Microsoft.Office.Interop.Excel.Application excelApp;
                {
                    string path = Alist;
                    excelApp = new Microsoft.Office.Interop.Excel.Application();
                    Microsoft.Office.Interop.Excel.Workbook analyWK = excelApp.Workbooks.Open(path, Type.Missing, Type.Missing, Type.Missing,
                                                                                              "htc", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                                                                              Type.Missing, Type.Missing, Type.Missing, Type.Missing);

                    Microsoft.Office.Interop.Excel.Worksheet WS = (Microsoft.Office.Interop.Excel.Worksheet)analyWK.Worksheets[1];
                    Microsoft.Office.Interop.Excel.Range     rng;
                    rng = WS.Range[WS.Cells[2, 1], WS.Cells[WS.UsedRange.Rows.Count, 26]];
                    int rowCount = WS.UsedRange.Rows.Count - 1;
                    object[,] o = new object[2, 1];
                    o           = (object[, ])rng.Value2;
                    int wscount = analyWK.Worksheets.Count;
                    clsCommHelp.CloseExcel(excelApp, analyWK);
                    for (int i = 1; i <= rowCount; i++)
                    {
                        clsDATAinfo temp = new clsDATAinfo();

                        #region 基础信息

                        temp.zhenghao = "";
                        if (o[i, 1] != null)
                        {
                            temp.zhenghao = o[i, 1].ToString().Trim();
                        }

                        temp.xingming = "";
                        if (o[i, 2] != null)
                        {
                            temp.xingming = o[i, 2].ToString().Trim();
                        }

                        if (temp.xingming == null || temp.xingming == "")
                        {
                            break;
                        }

                        temp.xingbie = "";
                        if (o[i, 3] != null)
                        {
                            temp.xingbie = o[i, 3].ToString().Trim();
                        }


                        temp.zuoyeleibie = "";
                        if (o[i, 4] != null)
                        {
                            temp.zuoyeleibie = o[i, 4].ToString().Trim();
                        }

                        temp.zhuncaoxiangmu = "";
                        if (o[i, 5] != null)
                        {
                            temp.zhuncaoxiangmu = o[i, 5].ToString().Trim();
                        }

                        temp.chulingriqi = "";
                        if (o[i, 6] != null)
                        {
                            temp.chulingriqi = o[i, 6].ToString().Trim();
                        }
                        temp.youxiangqixian = "";
                        if (o[i, 7] != null)
                        {
                            temp.youxiangqixian = o[i, 7].ToString().Trim();
                        }

                        temp.fushenriqi = "";
                        if (o[i, 8] != null)
                        {
                            temp.fushenriqi = o[i, 8].ToString().Trim();
                        }

                        temp.Input_Date = DateTime.Now;

                        #endregion
                        MAPPINGResult.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: 01032 表格维护有误,请重新检查格式及命名!");
                return(null);

                throw;
            }
            return(MAPPINGResult);
        }
示例#11
0
        /// <summary>
        /// 替换word中的文本,并导出word
        /// </summary>
        public void ReplaceToExcel(ref BackgroundWorker bgWorker, clsDATAinfo temp, string savefolder)
        {
            bgWorker1 = bgWorker;
            bgWorker1.ReportProgress(0, "准备中 ....");

            string ZFCEPath       = AppDomain.CurrentDomain.BaseDirectory + "Resources\\photo\\" + temp.xingming + ".jpg";
            string yinzhangweizhi = AppDomain.CurrentDomain.BaseDirectory + "Resources\\seal\\" + temp.Message + ".gif";//02.gif

            Word.Application app = null;
            Word.Document    doc = null;
            //将要导出的新word文件名
            string newFile = DateTime.Now.ToString("yyyyMMddHHmmssss") + ".doc";
            //  string physicNewFile = Server.MapPath(DateTime.Now.ToString("yyyyMMddHHmmssss") + ".doc");
            string physicNewFile = AppDomain.CurrentDomain.BaseDirectory + "Results\\" + temp.xingming + "-" + DateTime.Now.ToString("yyyyMMddHHmmssss") + ".doc";

            physicNewFile = savefolder + "\\" + temp.xingming + "-" + "" + DateTime.Now.ToString("yyyyMMddHHmmssss") + ".doc";;

            try
            {
                app = new Word.Application();//创建word应用程序

                //object fileName = Server.MapPath("template.doc");//模板文件
                object fileName = AppDomain.CurrentDomain.BaseDirectory + "Resources\\" + "TEL1.docx";

                //打开模板文件
                object oMissing = System.Reflection.Missing.Value;
                doc = app.Documents.Open(ref fileName,
                                         ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                         ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                         ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

                //构造数据
                Dictionary <string, string> datas = new Dictionary <string, string>();
                datas.Add("{zhenghao}", temp.zhenghao);
                datas.Add("{xingming}", temp.xingming);
                //datas.Add("{sex}", temp.xingbie);
                datas.Add("{zuoyeleibie}", temp.zuoyeleibie);

                datas.Add("{zhuncaoxiangmu}", temp.zhuncaoxiangmu);
                datas.Add("{chulingriqi}", temp.chulingriqi);
                datas.Add("{youxiaoqixian} ", temp.youxiangqixian);
                datas.Add("{fushenriqi}", temp.fushenriqi);



                object replace = Word.WdReplace.wdReplaceAll;
                foreach (var item in datas)
                {
                    app.Selection.Find.Replacement.ClearFormatting();
                    app.Selection.Find.ClearFormatting();
                    app.Selection.Find.Text             = item.Key;   //需要被替换的文本
                    app.Selection.Find.Replacement.Text = item.Value; //替换文本

                    //执行替换操作
                    app.Selection.Find.Execute(
                        ref oMissing, ref oMissing,
                        ref oMissing, ref oMissing,
                        ref oMissing, ref oMissing,
                        ref oMissing, ref oMissing, ref oMissing,
                        ref oMissing, ref replace,
                        ref oMissing, ref oMissing,
                        ref oMissing, ref oMissing);
                }
                //    doc.ActiveWindow.Visible = true;
                foreach (Bookmark bk in doc.Bookmarks)
                {
                    if (bk.Name == "sex")
                    {
                        bk.Range.Text = temp.xingbie;
                    }
                    //替换人的头像
                    else if (bk.Name == "image2" && File.Exists(ZFCEPath))
                    {
                        bk.Select();
                        Selection sel = app.Selection;
                        //sel.InlineShapes.AddPicture(ZFCEPath);

                        object Anchor = app.Selection.Range;

                        object LinkToFile       = false;
                        object SaveWithDocument = true;
                        //设置图片位置
                        app.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;
                        InlineShape inlineShape = app.ActiveDocument.InlineShapes.AddPicture(ZFCEPath, ref LinkToFile, ref SaveWithDocument, ref Anchor);

                        inlineShape.Width  = 94;  // 图片宽度
                        inlineShape.Height = 127; // 图片高度
                        //  Microsoft.Office.Interop.Word.Shape cShape = inlineShape.ConvertToShape();
                        // cShape.WrapFormat.Type = WdWrapType.wdWrapNone;
                    }
                    //r替换印章
                    else if (bk.Name == "seal" && File.Exists(yinzhangweizhi))
                    {
                        bk.Select();
                        Selection sel = app.Selection;

                        object Anchor           = app.Selection.Range;
                        object LinkToFile       = false;
                        object SaveWithDocument = true;
                        //设置图片位置
                        app.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;
                        InlineShape inlineShape = app.ActiveDocument.InlineShapes.AddPicture(yinzhangweizhi, ref LinkToFile, ref SaveWithDocument, ref Anchor);

                        inlineShape.Width  = 97; // 图片宽度
                        inlineShape.Height = 97; // 图片高度


                        //builder.InsertImage(stream, RelativeHorizontalPosition.Page, left, RelativeVerticalPosition.Page, 30, 75, 75, WrapType.None);

                        //WrapType.None
                        #region 使用Goto函数,跳转到指定书签
                        //object BookMarkName = "sex";
                        //object what = Word.WdGoToItem.wdGoToBookmark;
                        //doc.ActiveWindow.Selection.GoTo(ref what, ref Nothing, ref Nothing, ref BookMarkName);
                        //app.ActiveWindow.Selection.TypeText("Hello!");

                        #endregion
                    }
                    //模拟测试  用, 目的在word 内部设置 印章背景为 透明的,
                    else if (bk.Name == "test1")
                    {
                        bk.Select();
                        Selection sel = app.Selection;

                        object Anchor           = app.Selection.Range;
                        object LinkToFile       = false;
                        object SaveWithDocument = true;
                        //设置图片位置
                        app.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight;
                        InlineShape inlineShape = app.ActiveDocument.InlineShapes.AddPicture(yinzhangweizhi, ref LinkToFile, ref SaveWithDocument, ref Anchor);

                        inlineShape.Width  = 97; // 图片宽度
                        inlineShape.Height = 97; // 图片高度

                        //
                        #region 设置 背景透明  参照 word 录的宏 但不成功

                        ////doc.Application.ActiveDocument.InlineShapes[1].Reset();
                        ////doc.Application.ActiveDocument.InlineShapes[1].PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoTrue;
                        ////doc.Application.ActiveDocument.InlineShapes[1].PictureFormat.TransparencyColor = 0;//System.Drawing.Color.FromArgb(255, 0, 0);// RGB(255, 255,253)
                        ////doc.Application.ActiveDocument.InlineShapes[1].Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;



                        ////
                        ////将图片设置为四周环绕型
                        //Microsoft.Office.Interop.Word.Shape s = doc.Application.ActiveDocument.InlineShapes[1].ConvertToShape();
                        //s.WrapFormat.Type = Microsoft.Office.Interop.Word.WdWrapType.wdWrapSquare;
                        ////   //设置图片浮于文字之上 - 查阅WdWrapType的相关WdWrapType Enumeration
                        //s.WrapFormat.Type = WdWrapType.wdWrapNone;
                        //s.PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoCTrue;
                        ////设置背景图片透明
                        ////var blueScreen = RGB(0, 0, 255);
                        //var blueScreen1 = Color.FromArgb(0, 0, 255, 0);
                        ////  s.PictureFormat.TransparencyColor = 0;//blueScreen1;
                        ////inlineShape.PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoTrue; ;

                        //#region //Bit map
                        ////Bitmap bitmap = (Bitmap)System.Drawing.Image.FromFile(yinzhangweizhi);

                        ////Graphics g = System.Drawing.Graphics.FromImage(bitmap);
                        //////设置高质量插值法
                        ////g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

                        //////设置高质量,低速度呈现平滑程度
                        ////g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

                        //////清空画布并以透明背景色填充
                        ////g.Clear(Color.Transparent);
                        //#endregion
                        ////
                        //#region 录制的宏
                        ////Selection.InlineShapes(1).Reset
                        ////Selection.InlineShapes(1).PictureFormat.TransparentBackground = msoTrue
                        ////Selection.InlineShapes(1).PictureFormat.TransparencyColor = RGB(255, 255, _
                        ////    253)
                        ////Selection.InlineShapes(1).Fill.Visible = msoFalse
                        //#endregion
                        //doc.Application.ActiveDocument.InlineShapes[1].Reset();
                        //doc.Application.ActiveDocument.InlineShapes[1].PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoTrue;
                        //Color c1 = Color.FromArgb(255, 255, 253);
                        ////doc.Application.ActiveDocument.InlineShapes[1].PictureFormat.TransparencyColor = System.Drawing.Color.FromArgb(255, 0, 0);// RGB(255, 255,253)
                        //doc.Application.ActiveDocument.InlineShapes[1].Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;



                        ////   s.PictureFormat.TransparencyColor = RGB(0, 0, 0); //' RGB(212, 208, 200);
                        ////s.PictureFormat.o = System.Drawing.Color.Beige;
                        #endregion
                    }
                }
                #region 打印word
                //   // 实例化System.Windows.Forms.PrintDialog对象
                //   PrintDialog dialog = new PrintDialog();
                //   dialog.AllowPrintToFile = true;
                //   dialog.AllowCurrentPage = true;
                //   dialog.AllowSomePages = true;
                //   dialog.UseEXDialog = true;
                //   // 关联doc.PrintDialog属性和PrintDialog对象
                //   doc.PrintDialog = dialog;
                ////

                //   // 后台打印
                //   // PrintDocument printDoc = doc.PrintDocument;
                //   // printDoc.Print();
                //   // 显示打印对话框并打印
                //   if (dialog.ShowDialog() == DialogResult.OK)
                //   {
                //       //printDoc.Print();
                //   }


                string defaultPrinter = app.ActivePrinter;
                Externs.SetDefaultPrinter(orderprint);


                doc.PrintOut();
                #endregion


                //对替换好的word模板另存为一个新的word文档
                doc.SaveAs(physicNewFile,
                           oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
                           oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
            }
            catch (System.Threading.ThreadAbortException ex)
            {
                //这边为了捕获Response.End引起的异常
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (doc != null)
                {
                    doc.Close();//关闭word文档
                }
                if (app != null)
                {
                    app.Quit();//退出word应用程序
                }
                //如果文件存在则输出到客户端
                if (File.Exists(physicNewFile))
                {
                    //  Response.WriteFile(physicNewFile);
                }
            }
        }
示例#12
0
        public List <clsDATAinfo> findOrder(string findtext)
        {
            SQLiteConnection dbConn = new SQLiteConnection("Data Source=" + dataSource);

            dbConn.Open();
            SQLiteCommand dbCmd = dbConn.CreateCommand();

            dbCmd.CommandText = findtext;

            DbDataReader       reader             = SQLiteHelper.ExecuteReader("Data Source=" + newsth, dbCmd);
            List <clsDATAinfo> ClaimReport_Server = new List <clsDATAinfo>();

            while (reader.Read())
            {
                clsDATAinfo item = new clsDATAinfo();

                item.Item_ID = reader.GetInt32(0);
                if (reader.GetValue(1) != null && Convert.ToString(reader.GetValue(1)) != "")
                {
                    item.zhenghao = reader.GetString(1);
                }
                if (reader.GetValue(2) != null && Convert.ToString(reader.GetValue(2)) != "")
                {
                    item.xingming = Convert.ToString(reader.GetString(2));
                }
                if (reader.GetValue(3) != null && Convert.ToString(reader.GetValue(3)) != "")
                {
                    item.xingbie = reader.GetString(3);
                }
                if (reader.GetValue(4) != null && Convert.ToString(reader.GetValue(4)) != "")
                {
                    item.zuoyeleibie = reader.GetString(4);
                }
                if (reader.GetValue(5) != null && Convert.ToString(reader.GetValue(5)) != "")
                {
                    item.zhuncaoxiangmu = reader.GetString(5);
                }
                if (reader.GetValue(6) != null && Convert.ToString(reader.GetValue(6)) != "")
                {
                    item.chulingriqi = reader.GetString(6);
                }
                if (reader.GetValue(7) != null && Convert.ToString(reader.GetValue(7)) != "")
                {
                    item.youxiangqixian = reader.GetString(7);
                }
                if (reader.GetValue(8) != null && Convert.ToString(reader.GetValue(8)) != "")
                {
                    item.fushenriqi = reader.GetString(8);
                }

                if (reader.GetValue(9) != null && Convert.ToString(reader.GetValue(9)) != "")
                {
                    item.Input_Date = Convert.ToDateTime(reader.GetString(9));
                }


                if (reader.GetValue(10) != null && Convert.ToString(reader.GetValue(10)) != "")
                {
                    item.Message = Convert.ToString(reader.GetString(10));
                }

                ClaimReport_Server.Add(item);
            }
            return(ClaimReport_Server);
        }