static iTextSharp.text.Font fonttitle3 = new iTextSharp.text.Font(bf1, 10);    //表格內容字体,大小15
        public static void Exp_SY1_SY2()
        {
            PdfReader pdfReader; PdfStamper pdfStamper; AcroFields pdfFormFields;
            BaseFont  bf1 = BaseFont.CreateFont("C:\\Windows\\Fonts\\SIMSUN.TTC,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            //文件保存的真正路径
            String tempname = getfilename();

            if (tempname == "")
            {
                return;
            }
            string path = AppDomain.CurrentDomain.BaseDirectory;
            int    flag = 1;

            path = System.IO.Directory.GetParent(path).Parent.Parent.FullName + "\\SY1_SY2_MB.pdf";
            //MessageBox.Show(path);
            pdfReader                 = new PdfReader(path);//模板的路径
            pdfStamper                = new PdfStamper(pdfReader, new FileStream(tempname, FileMode.OpenOrCreate));
            pdfFormFields             = pdfStamper.AcroFields;
            pdfStamper.FormFlattening = true;
            pdfFormFields.AddSubstitutionFont(bf1);
            dtb = Export_All_SY.DBQuery("Sy1_Fdsk");
            Export_All_SY.DBDel("Sy1_Fdsk");
            Export_Table_Design.SY1_Table(pdfFormFields, ref flag, dtb);
            flag = 1;
            dtb  = Export_All_SY.DBQuery("Sy2_Gzzd");
            Export_All_SY.DBDel("Sy2_Gzzd");
            Export_Table_Design.SY2_Table(pdfFormFields, ref flag, dtb);
            pdfStamper.Close();
            pdfReader.Close();
        }
        /// <summary>
        /// 加载设计的pdf模板,并对需要赋值的地方赋值
        /// </summary>
        public static void Exp_PDF(int status)
        {
            String         str            = " ";
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "Text documents (*.pdf)|*.pdf";
            saveFileDialog.FilterIndex      = 0;
            saveFileDialog.RestoreDirectory = true;
            saveFileDialog.CreatePrompt     = true;
            saveFileDialog.Title            = "导出Text文件到";
            DateTime now = DateTime.Now;

            if (status == 0)
            {
                string date = now.Year.ToString().PadLeft(2) + "-" +
                              now.Month.ToString().PadLeft(2, '0') + "-" +
                              now.Day.ToString().PadLeft(2, '0');
                SY_Data data = new SY_Data(MainFrom.comBoxData_Form,
                                           MainFrom.textB_HbData_Form, MainFrom.textB_CgqData_Form,
                                           MainFrom.Uname, date);
                getCount(data);
                string[] com = MainFrom.comBoxData_Form.Split('/');
                string   pno = "";
                for (int k = 0; k < com.Length; k++)
                {
                    pno = pno + com[k];
                }
                saveFileDialog.FileName = count + "_" + pno + "_" +
                                          MainFrom.textB_HbData_Form + "_" +
                                          MainFrom.Uname + "_" + MainFrom.textB_CgqData_Form + "_" +
                                          now.Year.ToString().PadLeft(2) + "" +
                                          now.Month.ToString().PadLeft(2, '0') + "" +
                                          now.Day.ToString().PadLeft(2, '0') + "-" +
                                          now.Hour.ToString().PadLeft(2, '0') + "" +
                                          now.Minute.ToString().PadLeft(2, '0') + "" +
                                          now.Second.ToString().PadLeft(2, '0');
            }
            else
            {
                string[] com  = History.Cp_no.Split('/');
                string   p_no = "";
                for (int k = 0; k < com.Length; k++)
                {
                    p_no = p_no + com[k];
                }
                saveFileDialog.FileName = History.Sycs + "_" + p_no + "_" +
                                          History.Kzx_no + "_" +
                                          History.Czy + "_" + History.Cgq_no + "_" +
                                          History.Sy_date + "-" +
                                          now.Hour.ToString().PadLeft(2, '0') + "" +
                                          now.Minute.ToString().PadLeft(2, '0') + "" +
                                          now.Second.ToString().PadLeft(2, '0');
            }
            DialogResult result = saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                PdfReader pdfReader; PdfStamper pdfStamper; AcroFields pdfFormFields;
                BaseFont  bf1 = BaseFont.CreateFont("C:\\Windows\\Fonts\\SIMSUN.TTC,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
                //文件保存的真正路径
                string tempFilePath = saveFileDialog.FileName;
                string path = AppDomain.CurrentDomain.BaseDirectory, sql;
                int    flag = 1;
                if (MainFrom.comBoxData_Form == "HBK-II/1")
                {
                    path                      = System.IO.Directory.GetParent(path).Parent.Parent.FullName + "\\II型车.pdf";
                    pdfReader                 = new PdfReader(path);//模板的路径
                    pdfStamper                = new PdfStamper(pdfReader, new FileStream(tempFilePath, FileMode.OpenOrCreate));
                    pdfFormFields             = pdfStamper.AcroFields;
                    pdfStamper.FormFlattening = true;
                    pdfFormFields.AddSubstitutionFont(bf1);
                    if (status == 0)
                    {
                        pdfFormFields.SetField("CPXH", MainFrom.comBoxData_Form);
                        pdfFormFields.SetField("HBKZXBH", MainFrom.textB_HbData_Form);
                        pdfFormFields.SetField("JDCGQBH", MainFrom.textB_CgqData_Form);
                        pdfFormFields.SetField("SYY", MainFrom.Uname);
                    }
                    else
                    {
                        pdfFormFields.SetField("CPXH", History.Cp_no);
                        pdfFormFields.SetField("HBKZXBH", History.Kzx_no);
                        pdfFormFields.SetField("JDCGQBH", History.Cgq_no);
                        pdfFormFields.SetField("SYY", History.Czy);
                    }
                    //试验1的报表
                    if (status == 0)
                    {
                        dtb = SY1_DB();
                    }
                    else
                    {
                        dtb = History.Final_Pdf("SY1_Fdsk_Final");
                    }
                    Export_Table_Design.SY1_Table(pdfFormFields, ref flag, dtb);
                    flag = 1;
                    if (status == 0)
                    {
                        dtb = SY2_DB();
                    }
                    else
                    {
                        dtb = History.Final_Pdf("SY2_Gzzd_Final");
                    }
                    Export_Table_Design.SY2_Table(pdfFormFields, ref flag, dtb);
                    pdfStamper.Close();
                    pdfReader.Close();
                }
                else
                {
                    path                      = System.IO.Directory.GetParent(path).Parent.Parent.FullName + "\\I型车.pdf";
                    pdfReader                 = new PdfReader(path);//模板的路径
                    pdfStamper                = new PdfStamper(pdfReader, new FileStream(tempFilePath, FileMode.OpenOrCreate));
                    pdfFormFields             = pdfStamper.AcroFields;
                    pdfStamper.FormFlattening = true;
                    pdfFormFields.AddSubstitutionFont(bf1);
                    if (status == 0)
                    {
                        pdfFormFields.SetField("CPXH", MainFrom.comBoxData_Form);
                        pdfFormFields.SetField("HBKZXBH", MainFrom.textB_HbData_Form);
                        pdfFormFields.SetField("JDCGQBH", MainFrom.textB_CgqData_Form);
                        pdfFormFields.SetField("SYY", MainFrom.Uname);
                    }
                    else
                    {
                        pdfFormFields.SetField("CPXH", History.Cp_no);
                        pdfFormFields.SetField("HBKZXBH", History.Kzx_no);
                        pdfFormFields.SetField("JDCGQBH", History.Cgq_no);
                        pdfFormFields.SetField("SYY", History.Czy);
                    }
                    //试验1的报表
                    if (status == 0)
                    {
                        dtb = SY1_DB();
                    }
                    else
                    {
                        dtb = History.Final_Pdf("SY1_Fdsk_Final");
                    }
                    Export_Table_Design.SY1_Table(pdfFormFields, ref flag, dtb);
                    flag = 1;
                    if (status == 0)
                    {
                        dtb = SY2_DB();
                    }
                    else
                    {
                        dtb = History.Final_Pdf("SY2_Gzzd_Final");
                    }
                    Export_Table_Design.SY2_Table(pdfFormFields, ref flag, dtb);
                    pdfStamper.Close();
                    pdfReader.Close();
                }

                Exp_PDF1(saveFileDialog.FileName, status);
            }
        }