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()); }
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()); }
public IActionResult FileMakerPDF() { PageOfficeNetCore.FileMakerCtrl fileMakerCtrl = new PageOfficeNetCore.FileMakerCtrl(Request); fileMakerCtrl.ServerPage = "/PageOffice/POServer"; //设置保存页面 fileMakerCtrl.SaveFilePage = "SaveDoc"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); //禁用右击事件 doc.DisableWindowRightClick = true; //给数据区域赋值,即把数据填充到模板中相应的位置 doc.OpenDataRegion("PO_company").Value = "北京卓正志远软件有限公司"; fileMakerCtrl.SetWriter(doc); fileMakerCtrl.JsFunction_OnProgressComplete = "OnProgressComplete()"; fileMakerCtrl.FillDocumentAsPDF("../FileMakerPDF/doc/template.doc", PageOfficeNetCore.DocumentOpenType.Word, "a.pdf"); ViewBag.fmCtrl = fileMakerCtrl.GetHtmlCode("FileMakerCtrl1"); return(View()); }
public IActionResult Convert() { String id = Request.Query["id"]; String filePath = ""; string webRootPath = _webHostEnvironment.WebRootPath; if ("1".Equals(id)) { //filePath = webRootPath+"/FileMakerConvertPDFs/doc/PageOffice产品简介.doc"; filePath = webRootPath + "/FileMakerConvertPDFs/doc/PageOffice产品简介.doc"; } if ("2".Equals(id)) { filePath = webRootPath + "/FileMakerConvertPDFs/doc/Pageoffice客户端安装步骤.doc"; } if ("3".Equals(id)) { filePath = webRootPath + "/FileMakerConvertPDFs/doc/PageOffice的应用领域.doc"; } if ("4".Equals(id)) { filePath = webRootPath + "/FileMakerConvertPDFs/doc/PageOffice产品对客户端环境要求.doc"; } filePath = filePath.Replace("/", "\\"); PageOfficeNetCore.FileMakerCtrl fileMakerCtrl = new PageOfficeNetCore.FileMakerCtrl(Request); fileMakerCtrl.ServerPage = "/PageOffice/POServer"; //设置保存页面 fileMakerCtrl.SaveFilePage = "SaveDoc"; //设置转换完成后执行的JS函数 fileMakerCtrl.JsFunction_OnProgressComplete = "OnProgressComplete()"; //打开文档 fileMakerCtrl.FillDocumentAsPDF(filePath, PageOfficeNetCore.DocumentOpenType.Word, "aa.pdf"); ViewBag.fmCtrl = fileMakerCtrl.GetHtmlCode("FileMakerCtrl1"); return(View()); }