public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); doc.Template.DefineDataTag("{ 甲方 }"); doc.Template.DefineDataTag("{ 乙方 }"); doc.Template.DefineDataTag("{ 担保人 }"); doc.Template.DefineDataTag("【 合同日期 】"); doc.Template.DefineDataTag("【 合同编号 】"); pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); pageofficeCtrl.AddCustomToolButton("定义数据标签", "ShowDefineDataTags()", 20); pageofficeCtrl.Theme = PageOfficeNetCore.ThemeType.Office2007; pageofficeCtrl.BorderStyle = PageOfficeNetCore.BorderStyleType.BorderThin; pageofficeCtrl.SetWriter(doc); //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument wordDoc = new PageOfficeNetCore.WordWriter.WordDocument(); //打开数据区域,OpenDataRegion方法的参数代表Word文档中的书签名称 PageOfficeNetCore.WordWriter.DataRegion dataRegion1 = wordDoc.OpenDataRegion("PO_userName"); //设置DataRegion的可编辑性 dataRegion1.Editing = true; //为DataRegion赋值,此处的值可在页面中打开Word文档后在自己进行修改 dataRegion1.Value = ""; PageOfficeNetCore.WordWriter.DataRegion dataRegion2 = wordDoc.OpenDataRegion("PO_deptName"); dataRegion2.Editing = true; dataRegion2.Value = ""; pageofficeCtrl.SetWriter(wordDoc); pageofficeCtrl.SaveDataPage = "SaveData"; pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument wordDoc = new PageOfficeNetCore.WordWriter.WordDocument(); //打开数据区域,OpenDataRegion方法的参数代表Word文档中的书签名称 PageOfficeNetCore.WordWriter.DataRegion dataRegion1 = wordDoc.OpenDataRegion("PO_userName"); //为DataRegion赋值 dataRegion1.Value = "张三"; //设置字体样式 dataRegion1.Font.Color = Color.Blue; dataRegion1.Font.Size = 24f; dataRegion1.Font.Name = "隶书"; dataRegion1.Font.Bold = true; PageOfficeNetCore.WordWriter.DataRegion dataRegion2 = wordDoc.OpenDataRegion("PO_deptName"); dataRegion2.Value = "人事部"; dataRegion2.Font.Color = Color.Red; pageofficeCtrl.SetWriter(wordDoc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult ExcelFill() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.ExcelWriter.Workbook wk = new PageOfficeNetCore.ExcelWriter.Workbook(); PageOfficeNetCore.ExcelWriter.Sheet sheet = wk.OpenSheet("Sheet1"); PageOfficeNetCore.ExcelWriter.Table table = sheet.OpenTableByDefinedName("report", 10, 5, false); table.DataFields[0].Value = "轮胎"; table.DataFields[1].Value = "100"; table.DataFields[2].Value = "120"; table.DataFields[3].Value = "500"; table.DataFields[4].Value = "120%"; table.NextRow(); table.Close(); pageofficeCtrl.SetWriter(wk);// 注意不要忘记此代码,如果缺少此句代码,不会赋值成功。 pageofficeCtrl.Caption = "给Excel文档中定义名称的单元格赋值"; pageofficeCtrl.SaveDataPage = "SaveData"; pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult template() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "../PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); doc.Template.DefineDataRegion("Name", "[ 担保人姓名 ]"); doc.Template.DefineDataRegion("Address", "[ 担保人地址 ]"); doc.Template.DefineDataRegion("Tel", "[ 担保人电话 ]"); doc.Template.DefineDataRegion("Phone", "[ 担保人手机 ]"); doc.Template.DefineDataRegion("Sex", "[ 担保人性别 ]"); doc.Template.DefineDataRegion("Age", "[ 担保人年龄 ]"); doc.Template.DefineDataTag("{ 甲方公司名称 }"); doc.Template.DefineDataTag("{ 乙方公司名称 }"); doc.Template.DefineDataTag("【 合同日期 】"); doc.Template.DefineDataTag("【 合同编号 】"); pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); pageofficeCtrl.AddCustomToolButton("定义数据区域", "ShowDefineDataRegions()", 3); pageofficeCtrl.AddCustomToolButton("定义数据标签", "ShowDefineDataTags()", 20); pageofficeCtrl.Theme = PageOfficeNetCore.ThemeType.Office2007; pageofficeCtrl.BorderStyle = PageOfficeNetCore.BorderStyleType.BorderThin; pageofficeCtrl.SetWriter(doc); //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //打开Word文档 pageofficeCtrl.WebOpen("/doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Compose2() { int num = 1;//试题编号 string idlist = Request.Query["ids"]; string[] ids = idlist.Split(',');//将idlist按照","截取后存到ids数组中,然后遍历数组用js插入文件即可 PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; string temp = "PO_begin";//新添加的数据区域名称 PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); for (int i = 0; i < ids.Length; i++) { PageOfficeNetCore.WordWriter.DataRegion dataNum = doc.CreateDataRegion("PO_" + num, PageOfficeNetCore.WordWriter.DataRegionInsertType.After, temp); dataNum.Value = num + ".\t"; PageOfficeNetCore.WordWriter.DataRegion dataReg = doc.CreateDataRegion("PO_begin" + (i + 1), PageOfficeNetCore.WordWriter.DataRegionInsertType.After, "PO_" + num); dataReg.Value = "[word]Openfile?id=" + ids[i] + "[/word]"; num++; temp = "PO_begin" + (i + 1); } pageofficeCtrl.SetWriter(doc); pageofficeCtrl.Caption = "生成试卷"; pageofficeCtrl.CustomToolbar = false; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docReadOnly, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); //获取Table所在的数据区域对象 PageOfficeNetCore.WordWriter.DataRegion dataRegion = doc.OpenDataRegion("PO_regTable"); //打开table,OpenTable(index)方法中的index代表Word文档中table位置的索引,从1开始 PageOfficeNetCore.WordWriter.Table table = dataRegion.OpenTable(1); //给table中的单元格赋值, OpenCellRC(行, 列) table.OpenCellRC(3, 1).Value = "A公司"; table.OpenCellRC(3, 2).Value = "开发部"; table.OpenCellRC(3, 3).Value = "李清"; //插入一空行,InsertRowAfter方法中的参数表示在哪个单元格下面插入一行 table.InsertRowAfter(table.OpenCellRC(3, 3)); table.OpenCellRC(4, 1).Value = "B公司"; table.OpenCellRC(4, 2).Value = "销售部"; table.OpenCellRC(4, 3).Value = "张三"; pageofficeCtrl.SetWriter(doc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); PageOfficeNetCore.WordWriter.DataRegion dataReg = doc.OpenDataRegion("PO_table"); PageOfficeNetCore.WordWriter.Table table = dataReg.OpenTable(1); //合并table中的单元格 table.OpenCellRC(1, 1).MergeTo(1, 4); //给合并后的单元格赋值 table.OpenCellRC(1, 1).Value = "销售情况表"; //设置单元格文本样式 table.OpenCellRC(1, 1).Font.Color = Color.Red; table.OpenCellRC(1, 1).Font.Size = 24; table.OpenCellRC(1, 1).Font.Name = "楷体"; table.OpenCellRC(1, 1).ParagraphFormat.Alignment = PageOfficeNetCore.WordWriter.WdParagraphAlignment.wdAlignParagraphCenter; pageofficeCtrl.SetWriter(doc);//不要忘记此句代码 pageofficeCtrl.CustomToolbar = false; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Excel() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //定义Workbook对象 PageOfficeNetCore.ExcelWriter.Workbook workBook = new PageOfficeNetCore.ExcelWriter.Workbook(); //定义Sheet对象,"Sheet1"是打开的Excel表单的名称 PageOfficeNetCore.ExcelWriter.Sheet sheet = workBook.OpenSheet("Sheet1"); //定义Cell对象,给单元格赋值 PageOfficeNetCore.ExcelWriter.Cell cellB4 = sheet.OpenCell("B4"); cellB4.Value = "1月"; //或者直接给Cell赋值 sheet.OpenCell("C4").Value = "300"; sheet.OpenCell("D4").Value = "270"; sheet.OpenCell("E4").Value = "270"; sheet.OpenCell("F4").Value = string.Format("{0:P}", 270.0 / 300); pageofficeCtrl.SetWriter(workBook);// 注意不要忘记此代码,如果缺少此句代码,不会赋值成功。 pageofficeCtrl.Caption = "简单的给Excel赋值"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; // 设置保存文件页面 PageOfficeNetCore.WordWriter.WordDocument wordDoc = new PageOfficeNetCore.WordWriter.WordDocument(); pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); pageofficeCtrl.CustomToolbar = true; //打开数据区域,openDataRegion方法的参数代表Word文档中的书签名称 PageOfficeNetCore.WordWriter.DataRegion dataRegion1 = wordDoc.OpenDataRegion("PO_test1"); dataRegion1.SubmitAsFile = true; PageOfficeNetCore.WordWriter.DataRegion dataRegion2 = wordDoc.OpenDataRegion("PO_test2"); dataRegion2.SubmitAsFile = true; dataRegion2.Editing = true; PageOfficeNetCore.WordWriter.DataRegion dataRegion3 = wordDoc.OpenDataRegion("PO_test3"); dataRegion3.SubmitAsFile = true; pageofficeCtrl.SetWriter(wordDoc); pageofficeCtrl.SaveDataPage = "SaveData"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Excel() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.ExcelWriter.Workbook workBook = new PageOfficeNetCore.ExcelWriter.Workbook(); PageOfficeNetCore.ExcelWriter.Sheet sheet = workBook.OpenSheet("Sheet1"); //定义table对象,设置table对象的设置范围 PageOfficeNetCore.ExcelWriter.Table table = sheet.OpenTable("B4:D8"); //设置table对象的提交名称,以便保存页面获取提交的数据 table.SubmitName = "Info"; pageofficeCtrl.SetWriter(workBook); // 设置响应单元格点击事件的js function pageofficeCtrl.JsFunction_OnExcelCellClick = "OnCellClick()"; pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); //设置保存页面 pageofficeCtrl.SaveDataPage = "SaveData"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //定义WordDocument对象 PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); //定义DataTag对象 PageOfficeNetCore.WordWriter.DataTag deptTag = doc.OpenDataTag("{部门名}"); deptTag.Font.Color = Color.Green; //给DataTag对象赋值 deptTag.Value = "技术"; PageOfficeNetCore.WordWriter.DataTag userTag = doc.OpenDataTag("{姓名}"); userTag.Font.Color = Color.Green; userTag.Value = "李四"; PageOfficeNetCore.WordWriter.DataTag dateTag = doc.OpenDataTag("【时间】"); dateTag.Font.Color = Color.Blue; dateTag.Value = DateTime.Now.ToString("yyyy-MM-dd"); pageofficeCtrl.SetWriter(doc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test2.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Excel() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //定义Workbook对象 PageOfficeNetCore.ExcelWriter.Workbook workBook = new PageOfficeNetCore.ExcelWriter.Workbook(); //定义Sheet对象,"Sheet1"是打开的Excel表单的名称 PageOfficeNetCore.ExcelWriter.Sheet sheet = workBook.OpenSheet("Sheet1"); //定义Table对象 PageOfficeNetCore.ExcelWriter.Table table = sheet.OpenTable("B4:F13"); for (int i = 0; i < 50; i++) { table.DataFields[0].Value = "产品 " + i.ToString(); table.DataFields[1].Value = "100"; table.DataFields[2].Value = (100 + i).ToString(); table.NextRow(); } table.Close(); pageofficeCtrl.SetWriter(workBook);// 注意不要忘记此代码,如果缺少此句代码,不会赋值成功。 pageofficeCtrl.Caption = "使用OpenTable给Excel赋值"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); PageOfficeNetCore.WordWriter.DataRegion d1 = doc.OpenDataRegion("d1"); d1.Font.Color = Color.Green; //设置数据区域文本字体颜色 d1.Font.Name = "华文彩云"; //设置数据区域文本字体样式 d1.Font.Size = 16; //设置数据区域文本字体大小 d1.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; //设置数据区域文本对齐方式 PageOfficeNetCore.WordWriter.DataRegion d2 = doc.OpenDataRegion("d2"); d2.Font.Color = Color.MediumAquamarine; //设置数据区域文本字体颜色 d2.Font.Name = "黑体"; //设置数据区域文本字体样式 d2.Font.Size = 14; //设置数据区域文本字体大小 d2.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; //设置数据区域文本对齐方式 PageOfficeNetCore.WordWriter.DataRegion d3 = doc.OpenDataRegion("d3"); d3.Font.Color = Color.Purple; //设置数据区域文本字体颜色 d3.Font.Name = "华文行楷"; //设置数据区域文本字体样式 d3.Font.Size = 12; //设置数据区域文本字体大小 d3.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight; //设置数据区域文本对齐方式 pageofficeCtrl.SetWriter(doc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { string user = Request.Query["user"]; user = "******"; string userName = ""; PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "../PageOffice/POServer"; pageofficeCtrl.Caption = "钢材采购合同"; if (user == "zhangsan") { userName = "******"; pageofficeCtrl.CustomToolbar = false; } else if (user == "lisi") { userName = "******"; pageofficeCtrl.CustomToolbar = false; } else if (user == "wangwu") { userName = "******"; pageofficeCtrl.SaveFilePage = "SaveDoc"; pageofficeCtrl.AddCustomToolButton("保存", "Save", 1); pageofficeCtrl.AddCustomToolButton("盖章", "AddSeal", 2); pageofficeCtrl.AddCustomToolButton("返回", "GoBack", 21); } //打开Word文档 pageofficeCtrl.WebOpen("/doc/test.doc", PageOfficeNetCore.OpenModeType.docReadOnly, userName); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); ViewBag.userName = userName; return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); PageOfficeNetCore.WordWriter.Table table1 = doc.OpenDataRegion("PO_T001").OpenTable(1); table1.OpenCellRC(1, 1).Value = "[image]doc/wang.gif[/image]"; int oldRowCount = 3; //表格中原有的行数 int dataRowCount = 5; //要填充数据的行数 // 扩充表格 for (int j = 0; j < dataRowCount - oldRowCount; j++) { table1.InsertRowAfter(table1.OpenCellRC(2, 5)); //在第2行的最后一个单元格下插入新行 } // 填充数据 int i = 1; while (i <= dataRowCount) { table1.OpenCellRC(i, 2).Value = "AA" + i.ToString(); table1.OpenCellRC(i, 3).Value = "BB" + i.ToString(); table1.OpenCellRC(i, 4).Value = "CC" + i.ToString(); table1.OpenCellRC(i, 5).Value = "DD" + i.ToString(); i++; } pageofficeCtrl.SetWriter(doc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test_table.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); doc.Template.DefineDataRegion("Name", "[ 姓名 ]"); doc.Template.DefineDataRegion("Address", "[ 地址 ]"); doc.Template.DefineDataRegion("Tel", "[ 电话 ]"); doc.Template.DefineDataRegion("Phone", "[ 手机 ]"); doc.Template.DefineDataRegion("Sex", "[ 性别 ]"); doc.Template.DefineDataRegion("Age", "[ 年龄 ]"); doc.Template.DefineDataRegion("Email", "[ 邮箱 ]"); doc.Template.DefineDataRegion("QQNo", "[ QQ号 ]"); doc.Template.DefineDataRegion("MSNNo", "[ MSN号 ]"); pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); pageofficeCtrl.AddCustomToolButton("定义数据区域", "ShowDefineDataRegions()", 3); pageofficeCtrl.Theme = PageOfficeNetCore.ThemeType.Office2007; pageofficeCtrl.BorderStyle = PageOfficeNetCore.BorderStyleType.BorderThin; pageofficeCtrl.SetWriter(doc); //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { String userName = "******"; String userId = Request.Query["userid"]; if (userId.Equals("1")) { userName = "******"; } else { userName = "******"; } PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //添加自定义按钮 pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //设置并发控制时间 pageofficeCtrl.TimeSlice = 20; // 设置并发控制时间, 单位:分钟 //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docRevisionOnly, userName); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); ViewBag.userName = userName; return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); //打开数据区域 PageOfficeNetCore.WordWriter.DataRegion dTable = doc.OpenDataRegion("PO_table"); //设置数据区域可编辑性 dTable.Editing = true; //打开数据区域中的表格,OpenTable(index)方法中的index为word文档中表格的下标,从1开始 PageOfficeNetCore.WordWriter.Table table1 = doc.OpenDataRegion("PO_Table").OpenTable(1); // 给表头单元格赋值 table1.OpenCellRC(1, 2).Value = "产品1"; table1.OpenCellRC(1, 3).Value = "产品2"; table1.OpenCellRC(2, 1).Value = "A部门"; table1.OpenCellRC(3, 1).Value = "B部门"; pageofficeCtrl.SetWriter(doc); //添加自定义按钮 pageofficeCtrl.AddCustomToolButton("保存", "Save", 1); pageofficeCtrl.AddCustomToolButton("全屏/还原", "IsFullScreen", 4); //设置保存页面 pageofficeCtrl.SaveDataPage = "SaveData"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); PageOfficeNetCore.WordWriter.DataRegion dataReg = doc.OpenDataRegion("PO_deptName"); //为方便用户知道哪些地方可以编辑,所以设置了数据区域的背景色 dataReg.Shading.BackgroundPatternColor = Color.Pink; //dataReg.Editing = true; pageofficeCtrl.SetWriter(doc); // 不要忘记此句代码 // 设置数据区域点击时的响应js函数 pageofficeCtrl.JsFunction_OnWordDataRegionClick = "OnWordDataRegionClick()"; pageofficeCtrl.AddCustomToolButton("保存", "Save", 1); pageofficeCtrl.OfficeToolbars = false; pageofficeCtrl.Caption = "为方便用户知道哪些地方可以编辑,所以设置了数据区域的背景色"; //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; string userName = ""; userName = Request.Form["userName"]; if ("zhangsan" == userName) { userName = "******"; } if ("lisi" == userName) { userName = "******"; } if ("wangwu" == userName) { userName = "******"; } //***************************卓正PageOffice组件的使用******************************** pageofficeCtrl.AddCustomToolButton("保存", "Save", 1); pageofficeCtrl.AddCustomToolButton("领导圈阅", "StartHandDraw", 3); //pageofficeCtrl.AddCustomToolButton("分层显示手写批注", "ShowHandDrawDispBar", 7); pageofficeCtrl.AddCustomToolButton("全屏/还原", "IsFullScreen", 4); pageofficeCtrl.JsFunction_AfterDocumentOpened = "ShowByUserName"; //设置保存页面 pageofficeCtrl.SaveFilePage = "SaveDoc"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, userName); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); ViewBag.userName = userName; return(View()); }
public IActionResult open() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "../PageOffice/POServer"; string type = Request.Query["type"].ToString(); PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); doc.EnableAllDataRegionsEditing = true; // 此属性可以设置在提交模式(docSubmitForm)下,所有的数据区域可以编辑 doc.OpenDataRegion("Name").Value = "张三"; doc.OpenDataRegion("Address").Value = "北京市丰台区南四环西路xxx号"; doc.OpenDataRegion("Tel").Value = "010-88882222"; doc.OpenDataRegion("Phone").Value = "13822225555"; doc.OpenDataRegion("Sex").Value = "男"; doc.OpenDataRegion("Age").Value = "21"; doc.OpenDataTag("{ 甲方公司名称 }").Value = "微软中国总部"; doc.OpenDataTag("{ 乙方公司名称 }").Value = "北京幻想科技公司"; doc.OpenDataTag("【 合同日期 】").Value = "2014年08月01日"; doc.OpenDataTag("【 合同编号 】").Value = "201408010001"; pageofficeCtrl.SetWriter(doc); if ("1" == type) { pageofficeCtrl.AddCustomToolButton("保存", "Save2()", 1); pageofficeCtrl.WebOpen("/doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "zhangsan"); } else if ("2" == type) { pageofficeCtrl.Menubar = true; pageofficeCtrl.CustomToolbar = false; pageofficeCtrl.OfficeToolbars = false; pageofficeCtrl.WebOpen("/doc/test.doc", PageOfficeNetCore.OpenModeType.docReadOnly, "zhangsan"); } else if ("3" == type) { pageofficeCtrl.AddCustomToolButton("保存", "Save()", 1); pageofficeCtrl.SaveDataPage = "SaveData"; pageofficeCtrl.OfficeToolbars = false; pageofficeCtrl.WebOpen("/doc/test.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "zhangsan"); } ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult SubmitDataOfDoc() { string docID = Request.Query["ID"]; string sql = "select * from leaveRecord where ID = " + docID; SqliteConnection conn = new SqliteConnection(connString); conn.Open(); SqliteCommand cmd = new SqliteCommand(sql, conn); cmd.ExecuteNonQuery(); cmd.CommandText = sql; SqliteDataReader dr = cmd.ExecuteReader(); PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "../PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); PageOfficeNetCore.WordWriter.DataRegion drName = doc.OpenDataRegion("PO_name"); drName.Editing = true; PageOfficeNetCore.WordWriter.DataRegion drDept = doc.OpenDataRegion("PO_dept"); drDept.Shading.BackgroundPatternColor = Color.Silver; //drDept.Editing = true; PageOfficeNetCore.WordWriter.DataRegion drCause = doc.OpenDataRegion("PO_cause"); drCause.Editing = true; PageOfficeNetCore.WordWriter.DataRegion drNum = doc.OpenDataRegion("PO_num"); drNum.Editing = true; PageOfficeNetCore.WordWriter.DataRegion drDate = doc.OpenDataRegion("PO_date"); drDate.Shading.BackgroundPatternColor = Color.Pink; //drDate.Editing = true; PageOfficeNetCore.WordWriter.DataRegion drTip = doc.OpenDataRegion("PO_tip"); drTip.Font.Italic = true; drTip.Value = "提示:带背景色的文字是只能通过选择设置,[]中的文字是可以录入编辑的。"; if (dr.Read()) { doc.OpenDataRegion("PO_name").Value = dr["Name"].ToString(); doc.OpenDataRegion("PO_dept").Value = dr["Dept"].ToString(); doc.OpenDataRegion("PO_cause").Value = dr["Cause"].ToString(); doc.OpenDataRegion("PO_num").Value = dr["Num"].ToString();; doc.OpenDataRegion("PO_date").Value = dr["SubmitTime"].ToString();; } dr.Close(); conn.Close(); // 设置界面样式 pageofficeCtrl.Caption = "用户填写请假条"; pageofficeCtrl.BorderStyle = PageOfficeNetCore.BorderStyleType.BorderThin; // 添加自定义工具条按钮 pageofficeCtrl.AddCustomToolButton("保存", "poSave", 1); pageofficeCtrl.AddCustomToolButton("全屏/还原", "poSetFullScreen", 4); pageofficeCtrl.JsFunction_OnWordDataRegionClick = "OnWordDataRegionClick()"; //获取数据对象 pageofficeCtrl.SetWriter(doc); //设置保存页面 pageofficeCtrl.SaveDataPage = "SaveData?ID=" + docID; //打开Word文档 pageofficeCtrl.WebOpen("/doc/template.doc", PageOfficeNetCore.OpenModeType.docSubmitForm, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word2() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; pageofficeCtrl.CustomToolbar = false; pageofficeCtrl.JsFunction_OnWordDataRegionClick = "OnWordSelectionChange()"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; //添加自定义按钮 pageofficeCtrl.AddCustomToolButton("获取选中的文本内容", "getSelectionText();", 5); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; // 设置文件打开后执行的js function pageofficeCtrl.JsFunction_AfterDocumentOpened = "AfterDocumentOpened()"; //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult word3() { string DocID = Request.Query["ID"]; string sql = "select * from word where id= " + DocID + ";"; SqliteConnection conn = new SqliteConnection(connString); String lz = "张三批阅";//流转 conn.Open(); SqliteCommand cmd = new SqliteCommand(sql, conn); cmd.ExecuteNonQuery(); cmd.CommandText = sql; SqliteDataReader dr = cmd.ExecuteReader(); PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "../PageOffice/POServer"; string Literal_Subject_Text = ""; string Literal_Lc_Text = ""; string fileName = ""; while (dr.Read()) { Literal_Subject_Text = dr["Subject"].ToString();//文件名称 if ("正式发文" == dr["Status"].ToString()) { Literal_Lc_Text = dr["Status"].ToString();//当前文件的流程 } else { Literal_Lc_Text = "已流转到“" + dr["Status"].ToString() + "”,当前是“只读模式”打开文件的效果。"; } fileName = dr["FileName"].ToString(); string fileSubject = dr["Subject"].ToString(); pageofficeCtrl.Caption = fileSubject; } //设置保存页面 pageofficeCtrl.SaveFilePage = "/Edit/SaveDoc"; pageofficeCtrl.AddCustomToolButton("另存到本地", "ShowDialog(0)", 5); pageofficeCtrl.AddCustomToolButton("页面设置", "ShowDialog(1)", 0); pageofficeCtrl.AddCustomToolButton("打印", "ShowDialog(2)", 6); pageofficeCtrl.AddCustomToolButton("全屏/还原", "IsFullScreen", 4); //打开Word文档 pageofficeCtrl.WebOpen("/doc/" + fileName, PageOfficeNetCore.OpenModeType.docReadOnly, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); ViewBag.Literal_Subject_Text = Literal_Subject_Text; ViewBag.Literal_Lc_Text = Literal_Lc_Text; ViewBag.DocID = DocID; ViewBag.lz = lz; ViewBag.fileName = fileName; return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; // 添加一个自定义工具条上的按钮,AddCustomToolButton的参数说明,详见开发帮助。 pageofficeCtrl.AddCustomToolButton("测试按钮", "myTest", 0); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }
public IActionResult Word() { PageOfficeNetCore.PageOfficeCtrl pageofficeCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request); pageofficeCtrl.ServerPage = "/PageOffice/POServer"; PageOfficeNetCore.WordWriter.WordDocument doc = new PageOfficeNetCore.WordWriter.WordDocument(); //获取Table所在的数据区域对象 PageOfficeNetCore.WordWriter.DataRegion dataRegion = doc.OpenDataRegion("PO_regTable"); //打开table,OpenTable(index)方法中的index代表Word文档中table位置的索引,从1开始 PageOfficeNetCore.WordWriter.Table table = dataRegion.OpenTable(1); //给table中的单元格赋值, OpenCellRC(行, 列) table.OpenCellRC(3, 1).Value = "A公司"; table.OpenCellRC(3, 2).Value = "开发部"; table.OpenCellRC(3, 3).Value = "李清"; //插入一空行,InsertRowAfter方法中的参数表示在哪个单元格下面插入一行 table.InsertRowAfter(table.OpenCellRC(3, 3)); table.OpenCellRC(4, 1).Value = "B公司"; table.OpenCellRC(4, 2).Value = "销售部"; table.OpenCellRC(4, 3).Value = "张三"; //设置表格行的高度 table.SetRowsHeight(30.5f); //设置表格的边框样式 PageOfficeNetCore.WordWriter.Border border = table.Border; // 设置边框的类型 border.BorderType = PageOfficeNetCore.WordWriter.WdBorderType.wdFullGrid; //包含内边框 //设置边框的颜色 border.LineColor = Color.Red; //设置边框的线条样式 border.LineStyle = PageOfficeNetCore.WordWriter.WdLineStyle.wdLineStyleDot; //设置边框的粗细 border.LineWidth = PageOfficeNetCore.WordWriter.WdLineWidth.wdLineWidth150pt; //设置表格字体样式 PageOfficeNetCore.WordWriter.Font font = dataRegion.Font; //设置字体的是否加粗 font.Bold = true; //设置字体的颜色 font.Color = Color.Blue; //设置字体是否为斜体 font.Italic = true; //设置字体名称 font.Name = "宋体"; //设置字体大小 font.Size = 15.5f; pageofficeCtrl.SetWriter(doc); //打开Word文档 pageofficeCtrl.WebOpen("doc/test.doc", PageOfficeNetCore.OpenModeType.docNormalEdit, "tom"); ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1"); return(View()); }