public IActionResult FileMaker()
        {
            PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument();
            doc.OpenDataRegion("Name").Value    = "王五";
            doc.OpenDataRegion("Name").Editing  = true;// docSubmitForm提交模式打开文件的话,此区域可以编辑
            doc.OpenDataRegion("Address").Value = "上海市xx区南xxx路xxx号";
            doc.OpenDataRegion("Tel").Value     = "021-66662222";
            doc.OpenDataRegion("Phone").Value   = "13811112222";
            doc.OpenDataRegion("Sex").Value     = "男";
            doc.OpenDataRegion("Age").Value     = "28";
            doc.OpenDataTag("{ 甲方公司名称 }").Value = "北京联想公司";
            doc.OpenDataTag("{ 乙方公司名称 }").Value = "北京幻想科技公司";
            doc.OpenDataTag("【 合同日期 】").Value   = "2014年08月01日";
            doc.OpenDataTag("【 合同编号 】").Value   = "201408010001";
            PageOfficeNetCore.FileMakerCtrl fileMakerCtrl = new PageOfficeNetCore.FileMakerCtrl(Request);
            fileMakerCtrl.ServerPage = "/PageOffice/POServer";

            fileMakerCtrl.SaveFilePage = "SaveDoc?type=2";
            fileMakerCtrl.SetWriter(doc);
            fileMakerCtrl.JsFunction_OnProgressComplete = "OnProgressComplete()";
            fileMakerCtrl.FillDocument("/doc/test.doc", PageOfficeNetCore.DocumentOpenType.Word);

            ViewBag.FMCtrl = fileMakerCtrl.GetHtmlCode("FileMakerCtrl1");
            return(View());
        }
Пример #2
0
        public IActionResult Print()
        {
            PageOfficeNetCore.FileMakerCtrl fileMakerCtrl = new PageOfficeNetCore.FileMakerCtrl(Request);
            fileMakerCtrl.ServerPage = "/PageOffice/POServer";

            string id = Request.Query["id"];

            if (id != null && id.Length > 0)
            {
                PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument();
                //禁用右击事件
                doc.DisableWindowRightClick = true;
                //给数据区域赋值,即把数据填充到模板中相应的位置
                doc.OpenDataRegion("PO_company").Value = "北京卓正志远软件有限公司  " + id;
                //设置保存页面
                fileMakerCtrl.SaveFilePage = "SaveDoc?id=" + id;
                fileMakerCtrl.SetWriter(doc);
                //设置转换完成后执行的JS函数
                fileMakerCtrl.JsFunction_OnProgressComplete = "OnProgressComplete()";
                //打开文档
                fileMakerCtrl.FillDocument("../PrintFiles/doc/template.doc", PageOfficeNetCore.DocumentOpenType.Word);
            }

            ViewBag.fmCtrl = fileMakerCtrl.GetHtmlCode("FileMakerCtrl1");
            return(View());
        }
Пример #3
0
        public IActionResult FileMakerSingle()
        {
            PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument();
            //禁用右击事件
            doc.DisableWindowRightClick = true;
            //给数据区域赋值,即把数据填充到模板中相应的位置
            doc.OpenDataRegion("PO_company").Value = "北京卓正志远软件有限公司";

            PageOfficeNetCore.FileMakerCtrl fileMakerCtrl = new PageOfficeNetCore.FileMakerCtrl(Request);
            fileMakerCtrl.ServerPage = "/PageOffice/POServer";

            fileMakerCtrl.SaveFilePage = "SaveDoc";
            fileMakerCtrl.SetWriter(doc);
            fileMakerCtrl.JsFunction_OnProgressComplete = "OnProgressComplete()";
            fileMakerCtrl.FileTitle = "newfilename.doc";
            fileMakerCtrl.FillDocument("../FileMakerSingle/doc/template.doc", PageOfficeNetCore.DocumentOpenType.Word);

            ViewBag.FMCtrl = fileMakerCtrl.GetHtmlCode("FileMakerCtrl1");
            return(View());
        }