using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Saving;
using Aspose.Words.Tables;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace CallCenter.Utility
{
    public class AsposeWord
    {
        /// <summary>
        /// word版本
        /// </summary>
        public int _docversion;

        /// <summary>
        /// word版本
        /// </summary>
        public int Docversion
        {
            get { return _docversion; }
            set { _docversion = value; }
        }
        public DocumentBuilder oWordApplic;
        public Aspose.Words.Document oDoc;
        public void OpenWithTemplate(string strFileName)
        {
            if (!string.IsNullOrEmpty(strFileName))
            {
                oDoc = new Aspose.Words.Document(strFileName);
            }
        }

        public void Open()
        {
            oDoc = new Aspose.Words.Document();
        }

        public void Builder()
        {
            oWordApplic = new DocumentBuilder(oDoc);
        }
        /// <summary>
        /// 保存文件
        /// </summary>
        /// <param name="strFileName"></param>
        public void SaveAs(string strFileName)
        {

            if (this.Docversion == 2007)
            {
                oDoc.Save(strFileName, SaveFormat.Docx);
            }
            else
            {
                oDoc.Save(strFileName, SaveFormat.Doc);
            }
        }

        /// <summary>
        /// 导出文件
        /// </summary>
        /// <param name="strFileName"></param>
        public byte[] ExportAs()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                oDoc.Save(ms, SaveOptions.CreateSaveOptions(SaveFormat.Doc));

                return ms.GetBuffer();
            }
        }


        /// <summary>
        /// 设置纸张
        /// </summary>
        /// <param name="papersize"></param>
        public void setPaperSize(string papersize)
        {

            switch (papersize)
            {
                case "A4":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A4;
                        section.PageSetup.Orientation = Orientation.Portrait;
                        section.PageSetup.VerticalAlignment = Aspose.Words.PageVerticalAlignment.Top;
                    }
                    break;
                case "A4H"://A4横向
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A4;
                        section.PageSetup.Orientation = Orientation.Landscape;
                        section.PageSetup.TextColumns.SetCount(2);
                        section.PageSetup.TextColumns.EvenlySpaced = true;
                        section.PageSetup.TextColumns.LineBetween = true;
                        //section.PageSetup.LeftMargin = double.Parse("3.35");
                        //section.PageSetup.RightMargin =double.Parse("0.99");
                    }
                    break;
                case "A3":
                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A3;
                        section.PageSetup.Orientation = Orientation.Portrait;

                    }

                    break;
                case "A3H"://A3横向

                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.A3;
                        section.PageSetup.Orientation = Orientation.Landscape;
                        section.PageSetup.TextColumns.SetCount(2);
                        section.PageSetup.TextColumns.EvenlySpaced = true;
                        section.PageSetup.TextColumns.LineBetween = true;

                    }

                    break;

                case "16K":

                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PaperSize = PaperSize.B5;
                        section.PageSetup.Orientation = Orientation.Portrait;
                    }

                    break;

                case "8KH":

                    foreach (Aspose.Words.Section section in oDoc)
                    {
                        section.PageSetup.PageWidth = double.Parse("36.4 ");//纸张宽度
                        section.PageSetup.PageHeight = double.Parse("25.7");//纸张高度
                        section.PageSetup.Orientation = Orientation.Landscape;
                        section.PageSetup.TextColumns.SetCount(2);
                        section.PageSetup.TextColumns.EvenlySpaced = true;
                        section.PageSetup.TextColumns.LineBetween = true;
                        //section.PageSetup.LeftMargin = double.Parse("3.35");
                        //section.PageSetup.RightMargin = double.Parse("0.99");
                    }
                    
                    break;
            }
        }

        /// <summary>
        /// 导出交办单
        /// </summary>
        public void CreateAssignWord(DataTable dt, DataTable jbdata, string usercode)
        {
            oWordApplic.MoveToBookmark("sxbh");//跳转到书签名是sxbh的位置
            oWordApplic.Write(dt.Rows[0]["F_WorkOrderId"].ToString());
            oWordApplic.MoveToBookmark("gdly");
            oWordApplic.Write(dt.Rows[0]["SourceName"].ToString());
            oWordApplic.MoveToBookmark("blsx");
            if (jbdata!=null && jbdata.Rows.Count>0  && jbdata.Rows[0]["F_LimitTime"] != null && jbdata.Rows[0]["F_LimitTime"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(jbdata.Rows[0]["F_LimitTime"].ToString()).ToString("yyyy-MM-dd"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("lxdh");
            oWordApplic.Write(dt.Rows[0]["F_CusPhone"].ToString());
            oWordApplic.MoveToBookmark("qssj");
            if (jbdata != null && jbdata.Rows.Count > 0 && jbdata.Rows[0]["F_SureTime"] != null && jbdata.Rows[0]["F_SureTime"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(jbdata.Rows[0]["F_SureTime"].ToString()).ToString("yyyy-MM-dd"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("slsj");
            if (dt.Rows[0]["F_DealTime"] != null && dt.Rows[0]["F_DealTime"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_DealTime"].ToString()).ToString("yyyy-MM-dd"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("ldr");
            oWordApplic.Write(dt.Rows[0]["F_CusName"].ToString());
            oWordApplic.MoveToBookmark("sxqy");
            oWordApplic.Write(dt.Rows[0]["F_SourceAddress"].ToString());
            oWordApplic.MoveToBookmark("nrzy");
            if (dt.Rows[0]["F_Content"] != null && dt.Rows[0]["F_Content"].ToString() != "")
            {
                oWordApplic.Write(dt.Rows[0]["F_Content"].ToString());
            }
            else
            {
                oWordApplic.Write(dt.Rows[0]["F_ComContent"].ToString());
            }
            oWordApplic.MoveToBookmark("zbdw");
            if(jbdata != null && jbdata.Rows.Count > 0)
                oWordApplic.Write(jbdata.Rows[0]["DeptName"].ToString());
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("xbdw");
            if (jbdata != null && jbdata.Rows.Count > 0)
                oWordApplic.Write(jbdata.Rows[0]["OtherDeptName"].ToString());
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("ddyj");
            if (jbdata != null && jbdata.Rows.Count > 0)
                oWordApplic.Write(jbdata.Rows[0]["F_AssignedOpinion"].ToString());
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("cbyj");
            oWordApplic.Write("");
            oWordApplic.MoveToBookmark("ldps");
            oWordApplic.Write("");
            oWordApplic.MoveToBookmark("cljg");
            oWordApplic.Write(dt.Rows[0]["F_Result"].ToString());
            oWordApplic.MoveToBookmark("shy");
            oWordApplic.Write(usercode);
            oWordApplic.MoveToBookmark("ddy");
            if (jbdata != null && jbdata.Rows.Count > 0)
                oWordApplic.Write(jbdata.Rows[0]["F_CreateUser"].ToString());
            else
                oWordApplic.Write("");
        }

        /// <summary>
        /// 导出政策专家库
        /// </summary>
        public void CreateProfessorWord(DataTable dt)
        {
            oWordApplic.MoveToBookmark("xh");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());
            oWordApplic.MoveToBookmark("zjxm");
            oWordApplic.Write(dt.Rows[0]["F_XingMing"].ToString());
            oWordApplic.MoveToBookmark("zjdw");
            oWordApplic.Write(dt.Rows[0]["F_DanWei"].ToString());
            oWordApplic.MoveToBookmark("ks");
            oWordApplic.Write(dt.Rows[0]["F_KeShi"].ToString());
            oWordApplic.MoveToBookmark("zw");
            oWordApplic.Write(dt.Rows[0]["F_ZhiWu"].ToString());
            oWordApplic.MoveToBookmark("sjhm");
            oWordApplic.Write(dt.Rows[0]["F_ShouJi"].ToString());
            oWordApplic.MoveToBookmark("bgdh");
            oWordApplic.Write(dt.Rows[0]["F_DianHua"].ToString());
            oWordApplic.MoveToBookmark("dq");
            oWordApplic.Write(dt.Rows[0]["F_DiQu"].ToString());
            oWordApplic.MoveToBookmark("sshy");
            oWordApplic.Write(dt.Rows[0]["F_HangYe"].ToString());
            oWordApplic.MoveToBookmark("sxsj");
            if (dt.Rows[0]["F_ShengXiaoShiJian"] != null && dt.Rows[0]["F_ShengXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShengXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("sxsj1");
            if (dt.Rows[0]["F_ShiXiaoShiJian"] != null && dt.Rows[0]["F_ShiXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShiXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("fbsj");
            if (dt.Rows[0]["F_FaBuShiJian"] != null && dt.Rows[0]["F_FaBuShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_FaBuShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
            else
                oWordApplic.Write("");
            oWordApplic.MoveToBookmark("fbr");
            oWordApplic.Write(dt.Rows[0]["F_FaBuRen"].ToString());
            oWordApplic.MoveToBookmark("fbdw");
            oWordApplic.Write(dt.Rows[0]["F_FaBuDanWei"].ToString());
            oWordApplic.MoveToBookmark("bsbm");
            oWordApplic.Write(dt.Rows[0]["F_BiaoShiBianMa"].ToString());
            oWordApplic.MoveToBookmark("zylyjj");
            oWordApplic.Write(dt.Rows[0]["F_ZhuanYeLingYuJianJie"].ToString());
            oWordApplic.MoveToBookmark("tp");

            if (dt.Rows[0]["F_TouXiang"] != null && dt.Rows[0]["F_TouXiang"].ToString() != "")
            {
                string imgPath = HttpContext.Current.Server.MapPath(dt.Rows[0]["F_TouXiang"].ToString());
                if (File.Exists(imgPath))
                {
                    oWordApplic.MoveToBookmark("tp");
                    oWordApplic.InsertImage(imgPath, RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Margin, 1, 100, 125, WrapType.Inline);
                }
            }
        }

        //导出办事指南
        public void CreateGuideWord(DataTable dt, DataTable dt2)
        {
            oWordApplic.MoveToBookmark("xh");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("xh1");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("fbdw");
            oWordApplic.Write(dt.Rows[0]["F_FaBuDanWei"].ToString());

            oWordApplic.MoveToBookmark("fbr");
            oWordApplic.Write(dt.Rows[0]["F_FaBuRen"].ToString());

            oWordApplic.MoveToBookmark("sshy");
            oWordApplic.Write(dt.Rows[0]["F_HangYe"].ToString());


            oWordApplic.MoveToBookmark("dq");
            oWordApplic.Write(dt.Rows[0]["F_DiQu"].ToString());


            oWordApplic.MoveToBookmark("fbsj");
            oWordApplic.Write(dt.Rows[0]["F_FaBuShiJian"].ToString());


            oWordApplic.MoveToBookmark("sxsj");

            if (dt.Rows[0]["F_ShengXiaoShiJian"] != null && dt.Rows[0]["F_ShengXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShengXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));



            oWordApplic.MoveToBookmark("sxsj1");

            if (dt.Rows[0]["F_ShiXiaoShiJian"] != null && dt.Rows[0]["F_ShiXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShiXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("yjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");


            oWordApplic.MoveToBookmark("yjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");

            oWordApplic.MoveToBookmark("ejgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name2"].ToString() : "");

            oWordApplic.MoveToBookmark("sjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name3"].ToString() : "");


            oWordApplic.MoveToBookmark("sjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name4"].ToString() : "");




            oWordApplic.MoveToBookmark("ywmc");
            oWordApplic.Write(dt.Rows[0]["F_YeWuMingCheng"].ToString());

            oWordApplic.MoveToBookmark("bsbm");
            oWordApplic.Write(dt.Rows[0]["F_BiaoShiBianMa"].ToString());



            oWordApplic.MoveToBookmark("sqtj");
            oWordApplic.Write(dt.Rows[0]["F_ShenQingTiaoJian"].ToString());

            oWordApplic.MoveToBookmark("zcyj");
            oWordApplic.Write(dt.Rows[0]["F_ZhengCeYiJu"].ToString());


            oWordApplic.MoveToBookmark("wsbllj");
            oWordApplic.Write(dt.Rows[0]["F_WangShangBanLiLianJie"].ToString());



            oWordApplic.MoveToBookmark("bllc");
            oWordApplic.Write(dt.Rows[0]["F_BanLiLiuCheng"].ToString());

            oWordApplic.MoveToBookmark("blcl");
            oWordApplic.Write(dt.Rows[0]["F_BanLiCaiLiao"].ToString());



            oWordApplic.MoveToBookmark("blsx");
            oWordApplic.Write(dt.Rows[0]["F_BanLiShiXian"].ToString());

            oWordApplic.MoveToBookmark("bldd");
            oWordApplic.Write(dt.Rows[0]["F_BanLiDiDian"].ToString());


            oWordApplic.MoveToBookmark("sjdh");
            if (dt.Rows[0]["F_BanLiShiJian"] != null && dt.Rows[0]["F_BanLiShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShiXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "，" + dt.Rows[0]["F_BanLiDianHua"].ToString());
            else
                oWordApplic.Write(dt.Rows[0]["F_BanLiDianHua"].ToString());

            oWordApplic.MoveToBookmark("qtsm");
            oWordApplic.Write(dt.Rows[0]["F_QiTaShuoMing"].ToString());

            oWordApplic.MoveToBookmark("bz");
            oWordApplic.Write(dt.Rows[0]["F_BeiZhu"].ToString());


            oWordApplic.MoveToBookmark("fjsc");
            oWordApplic.Write(dt.Rows[0]["fileurl"].ToString());
        }

        //导出部门职能,政策法规
        public void CreateDepartmentFunctionsWord(DataTable dt, DataTable dt2)
        {
            oWordApplic.MoveToBookmark("xh");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("xh1");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("fbdw");
            oWordApplic.Write(dt.Rows[0]["F_FaBuDanWei"].ToString());

            oWordApplic.MoveToBookmark("fbr");
            oWordApplic.Write(dt.Rows[0]["F_FaBuRen"].ToString());

            oWordApplic.MoveToBookmark("sshy");
            oWordApplic.Write(dt.Rows[0]["F_HangYe"].ToString());

            oWordApplic.MoveToBookmark("dq");
            oWordApplic.Write(dt.Rows[0]["F_DiQu"].ToString());

            oWordApplic.MoveToBookmark("fbsj");
            if (dt.Rows[0]["F_FaBuShiJian"] != null && dt.Rows[0]["F_FaBuShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_FaBuShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("sxsj");
            if (dt.Rows[0]["F_ShengXiaoShiJian"] != null && dt.Rows[0]["F_ShengXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShengXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("sxsj1");
            if (dt.Rows[0]["F_ShiXiaoShiJian"] != null && dt.Rows[0]["F_ShiXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShiXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("yjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");


            oWordApplic.MoveToBookmark("yjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");

            oWordApplic.MoveToBookmark("ejgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name2"].ToString() : "");

            oWordApplic.MoveToBookmark("sjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name3"].ToString() : "");

            oWordApplic.MoveToBookmark("sjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name4"].ToString() : "");

            oWordApplic.MoveToBookmark("fwwh");
            oWordApplic.Write(dt.Rows[0]["F_FaWenWenHao"].ToString());

            oWordApplic.MoveToBookmark("fwdw");
            oWordApplic.Write(dt.Rows[0]["F_FaWenDanWei"].ToString());

            oWordApplic.MoveToBookmark("znbm");
            oWordApplic.Write(dt.Rows[0]["F_ZhiNengBuMen"].ToString());

            oWordApplic.MoveToBookmark("bsbm");
            oWordApplic.Write(dt.Rows[0]["F_BiaoShiBianMa"].ToString());
            
            oWordApplic.MoveToBookmark("wjmc");
            oWordApplic.Write(dt.Rows[0]["F_WenJianMingCheng"].ToString());

            oWordApplic.MoveToBookmark("wjnr");
            oWordApplic.Write(dt.Rows[0]["F_WenJianNeiRong"].ToString());

            oWordApplic.MoveToBookmark("fjsc");
            oWordApplic.Write(dt.Rows[0]["fileurl"].ToString());
        }

        //热点问答 名词解释
        public void CreateHotSpotWord(DataTable dt, DataTable dt2)
        {
            oWordApplic.MoveToBookmark("xh");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("xh1");//跳转到书签名是xh的位置
            oWordApplic.Write(dt.Rows[0]["xh"].ToString());

            oWordApplic.MoveToBookmark("fbdw");
            oWordApplic.Write(dt.Rows[0]["F_FaBuDanWei"].ToString());

            oWordApplic.MoveToBookmark("fbr");
            oWordApplic.Write(dt.Rows[0]["F_FaBuRen"].ToString());

            oWordApplic.MoveToBookmark("sshy");
            oWordApplic.Write(dt.Rows[0]["F_HangYe"].ToString());
            
            oWordApplic.MoveToBookmark("dq");
            oWordApplic.Write(dt.Rows[0]["F_DiQu"].ToString());
            
            oWordApplic.MoveToBookmark("fbsj");
            if (dt.Rows[0]["F_FaBuShiJian"] != null && dt.Rows[0]["F_FaBuShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_FaBuShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("sxsj");
            if (dt.Rows[0]["F_ShengXiaoShiJian"] != null && dt.Rows[0]["F_ShengXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShengXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("sxsj1");
            if (dt.Rows[0]["F_ShiXiaoShiJian"] != null && dt.Rows[0]["F_ShiXiaoShiJian"].ToString() != "")
                oWordApplic.Write(DateTime.Parse(dt.Rows[0]["F_ShiXiaoShiJian"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));

            oWordApplic.MoveToBookmark("yjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");

            oWordApplic.MoveToBookmark("yjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name1"].ToString() : "");

            oWordApplic.MoveToBookmark("ejgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name2"].ToString() : "");

            oWordApplic.MoveToBookmark("sjgjc");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name3"].ToString() : "");

            oWordApplic.MoveToBookmark("sjgjc1");
            oWordApplic.Write(dt2.Rows.Count > 0 ? dt2.Rows[0]["leve1name4"].ToString() : "");

            oWordApplic.MoveToBookmark("fwwh");
            oWordApplic.Write(dt.Rows[0]["F_FaWenWenHao"].ToString());

            oWordApplic.MoveToBookmark("fwdw");
            oWordApplic.Write(dt.Rows[0]["F_FaWenDanWei"].ToString());

            oWordApplic.MoveToBookmark("bsbm");
            oWordApplic.Write(dt.Rows[0]["F_BiaoShiBianMa"].ToString());


            oWordApplic.MoveToBookmark("zcmc");
            oWordApplic.Write(dt.Rows[0]["F_ZhengCeMingCi"].ToString());

            oWordApplic.MoveToBookmark("rdwt");
            oWordApplic.Write(dt.Rows[0]["F_ReDianWenTi"].ToString());

            oWordApplic.MoveToBookmark("nrjd");
            oWordApplic.Write(dt.Rows[0]["F_WenTiJieDa"].ToString());

            oWordApplic.MoveToBookmark("jddw");
            oWordApplic.Write(dt.Rows[0]["F_JieDaDanWei"].ToString());

            oWordApplic.MoveToBookmark("fjsc");
            oWordApplic.Write(dt.Rows[0]["fileurl"].ToString());
        }
    }
}
