20230307 质量在线文档编辑修改

This commit is contained in:
2023-03-07 11:24:59 +08:00
parent f42d330b00
commit 1bbab53e2f
22 changed files with 532 additions and 104 deletions
@@ -1,4 +1,5 @@
using FineUIPro;
using BLL;
using FineUIPro;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,12 +15,26 @@ namespace WordEdit
public string url;
protected void Page_Load(object sender, EventArgs e)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string cmd= Request.QueryString["cmd"];
var a = cmd.Split('|');
if (a[1] == "CQMSMainPlan")
{
var model = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(a[0]);
string filepath = model.FilePath;
url = Funs.SGGLUrl + filepath;
}
else if (a[1]== "CQMSSubPlan")
{
var model = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(a[0]);
string filepath = model.FilePath;
url = Funs.SGGLUrl + filepath;
}
url = "http://localhost:8899/File/Word/集团公司安全监督检查管理办法.doc";
}
@@ -20,6 +20,11 @@
return null;
}
function custom_close() {
window.opener = null;
window.open('', '_self');
window.close();(strHello);
}
function openhtml(cmd) {
//判断插件是否安装
datatochildcmd = cmd;
@@ -54,7 +59,7 @@
//在父页面定义的跨浏览器插件应用程序关闭事件响应方法,且方法名不能自定义,必须是ntkoCloseEvent
function ntkoCloseEvent() {
if (CLOSEVENT) alert("跨浏览器插件应用程序窗口已关闭!");
if (CLOSEVENT) { custom_close(); }
}
//在父页面固定OnDataParentText方法名来获取子页面传过来的数据
@@ -0,0 +1,51 @@
<html>
<head>
<meta content="IE=10" http-equiv="X-UA-Compatible" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>跨浏览器插件检测</title>
<style>
.info
{
margin:30px auto auto auto; width:300px; font-family:'微软雅黑'; height:30px; text-align:center;
}
.info_img
{
float:left; width:30px; height:30px; background-color:#ff0000; color:#ffffff; line-height:30px; font-weight:bold; font-size:18px
}
.info_text
{
float:left; width:270px; height:30px; line-height:30px; font-size:18px
}
.butbar
{
margin:30px auto auto auto; width:300px; font-family:'微软雅黑'; height:60px; text-align:center;
}
.but
{
width:200px; height:60px; border:1px #e0e0e0 solid; line-height:60px; font-size:18px; margin-left:50px; cursor:pointer; color:#b0b0b0;
}
.but:hover
{
border:1px #bebebe solid; background-color:#f8f8f8;
}
</style>
</head>
<body>
<div class="info">
<div class="info_img">
!
</div>
<div class="info_text">
本机尚未安装跨浏览器插件。
</div>
</div>
<div class="butbar">
<div class="but" onclick="location.href='officecontrol/NTKO控件安装程序-评测专用演示版本.exe'">
点击下载安装插件
</div>
</div>
</body>
</html>
@@ -1,5 +1,6 @@
var ntko;//控件对象
var savecode = "save.aspx";//保存文档程序程序
var fileName = "";
window.onbeforeunload=function(e){
ntkocloseparentpage();
}
@@ -16,8 +17,8 @@ function init(cmd) {
ntko.AddDocTypePlugin(".pdf","PDF.NtkoDocument","4.0.1.0","officecontrol/ntkooledocallx64.cab",51,true);
}
if (cmd != "") {
alert(cmd);
ntko.OpenFromURL(cmd);
fileName = cmd;
}
/*if (cmd == 1)
{
@@ -164,7 +165,7 @@ function erropen(retHTML) {
}
//保存office文档
function saveFileToUrl() {
var fileName ="ntkocreatnew.docx"
/*
if (fileName.length == 0) { alert("请输入文件标题!"); document.all("filetitle").focus(); return false; }//判断文件标题输入域
var result, filedot;
@@ -202,10 +203,11 @@ function saveFileToUrl() {
fileType = "unkownfiletype";
filedot = ".doc";
}*/
retHTML = ntko.saveToURL("save.aspx",//提交到的url地址
"EDITFILE",//文件域的id,类似<input type=file id=upLoadFile 中的id
"savetype=1&fileType=Word.Document", //与控件一起提交的参数,savetype参数为要保存的文件格式office,html,pdf。filetype参数保存文件类型
"aboutus.docx", //上传文件的名称,类似<input type=file 的value
fileName, //上传文件的名称,类似<input type=file 的value
0 //与控件一起提交的表单id,也可以是form的序列号,这里应该是0.
);
/*switch (ntko.StatusCode) {
+1
View File
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="save.aspx.cs" Inherits="WordEdit.save" %>
@@ -0,0 +1,82 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WordEdit
{
public partial class save : System.Web.UI.Page
{
//参数savetype定义要另存的文档格式office,html,pdf
//参数filetype定义要保存的文档的文件内型
public string savetype, filetype, fid, title, fother, fname, fname1;
//定义文件上传路径目录
public string filepath, htmlpath, pdfpath, attachpath, delcount;
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write("ok");
//Response.End();
fid = Request.Form["fileid"];//获取文件ID
fname = Request.Form["filename"];//获取已有文件的名称
title = Request.Form["filetitle"];//获取文件的标题
savetype = Request.Form["savetype"];//获取文件另存为格式类型
filetype = Request.Form["filetype"];//获取当前文件的文件格式
fother = Request.Form["fileother"];
//filepath = db.getofficepath();
//htmlpath = db.gethtmlpath();
//pdfpath = db.getpdfpath();
//attachpath = db.getattachpath();
filepath = "D:\\我的代码\\在线文档编辑\\WordEdit\\WordEdit";
htmlpath = "";
pdfpath = "";
attachpath = "";
//根据保存类型调用相应处理方法
switch (savetype)
{
case "1":
saveoffice();
break;
default:
saveoffice();
break;
}
}
//保存文档为office
public void saveoffice()
{
string uploadoffiepath = Server.MapPath("~/");//上传文件的路径
// string uploadoffiepath = filepath;//上传文件的路径
string attpath = Server.MapPath(attachpath);//上传附件文件路径
System.Web.HttpFileCollection uploadFiles = Request.Files;
System.Web.HttpPostedFile theFile;
theFile = uploadFiles[0];
if (uploadFiles.GetKey(0).ToUpper() == "EDITFILE")//上传文档控件中的文档
{
/* string time = System.DateTime.Now.ToString();
if (fname == "" || fname == null)
{
fname = time + "." + theFile.FileName.Substring(theFile.FileName.LastIndexOf('\\') + 1);
}
fname = fname.Replace(":", ".");//上传文件到磁盘,文件名中不允许带:符号*/
// theFile.SaveAs(uploadoffiepath + @"\" + fname);
var path = theFile.FileName.Replace(Funs.SGGLUrl, "");
theFile.SaveAs(uploadoffiepath + path);
}
}
}
}
+17
View File
@@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace WordEdit
{
public partial class save
{
}
}