コード例 #1
0
        public IActionResult excel()
        {
            string           DocID = Request.Query["ID"];
            string           sql   = "select * from excel 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";
            string docFile = "";

            while (dr.Read())
            {
                docFile = dr["FileName"].ToString();
            }
            dr.Close();
            conn.Close();
            //设置保存页面
            pageofficeCtrl.SaveFilePage = "/Edit/SaveDoc";


            pageofficeCtrl.CustomMenuCaption = "自定义菜单(&N)";
            pageofficeCtrl.AddCustomMenuItem("显示标题(&T)", "CustomMenuItem1_Click()", true);
            pageofficeCtrl.AddCustomMenuItem("-", "", false);
            pageofficeCtrl.AddCustomMenuItem("领导圈阅(&D)", "CustomMenuItem2_Click()", true);

            pageofficeCtrl.AddCustomToolButton("保存", "CustomToolBar_Save()", 1);
            pageofficeCtrl.AddCustomToolButton("另存为...", "CustomToolBar_SaveAs()", 1);
            pageofficeCtrl.AddCustomToolButton("另存为Html", "CustomToolBar_SaveAsHtml()", 1);
            pageofficeCtrl.AddCustomToolButton("插入印章", "CustomToolBar_InsertSeal()", 2);
            pageofficeCtrl.AddCustomToolButton("领导圈阅", "CustomToolBar_HandDraw()", 3);
            pageofficeCtrl.AddCustomToolButton("全屏/还原", "CustomToolBar_FullScreen()", 4);
            pageofficeCtrl.BorderStyle = PageOfficeNetCore.BorderStyleType.BorderThin;

            //打开Word文档
            pageofficeCtrl.WebOpen("/doc/" + docFile, PageOfficeNetCore.OpenModeType.xlsNormalEdit, "tom");
            ViewBag.POCtrl = pageofficeCtrl.GetHtmlCode("PageOfficeCtrl1");
            ViewBag.time   = DateTime.Now.ToString("yyyy年MM月dd日 dddd");
            return(View());
        }
コード例 #2
0
        public IActionResult word1()
        {
            string           DocID    = Request.Query["ID"];
            string           userName = Request.Query["user"];
            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() && "李四" == userName) ||("张三批阅" == dr["Status"].ToString() && "张三" == userName))
                if ("文员清稿" == dr["Status"].ToString())
                {
                    Literal_Lc_Text = dr["Status"].ToString();//当前文件的流程
                    lz = "正式发文";
                }
                else
                {
                    Literal_Lc_Text = "已流转到“" + dr["Status"].ToString() + "”,当前是“核稿模式”打开文件的效果。";
                }
                fileName = dr["FileName"].ToString();
                string fileSubject = dr["Subject"].ToString();
                pageofficeCtrl.Caption = fileSubject;
            }
            pageofficeCtrl.CustomMenuCaption = "自定义菜单";
            pageofficeCtrl.AddCustomMenuItem("显示痕迹", "ShowRevisions", false);
            pageofficeCtrl.AddCustomMenuItem("隐藏痕迹", "HiddenRevisions", false);
            pageofficeCtrl.AddCustomMenuItem("-", "", false);
            pageofficeCtrl.AddCustomMenuItem("显示标题", "ShowTitle", true);
            pageofficeCtrl.AddCustomMenuItem("-", "", false);
            pageofficeCtrl.AddCustomMenuItem("领导圈阅", "StartHandDraw", true);
            pageofficeCtrl.AddCustomMenuItem("-", "", false);
            pageofficeCtrl.AddCustomMenuItem("分层显示手写批注", "ShowHandDrawDispBar", true);

            pageofficeCtrl.AddCustomToolButton("保存", "Save", 1);
            pageofficeCtrl.AddCustomToolButton("另存为Html", "SaveAsHtml", 0);
            pageofficeCtrl.AddCustomToolButton("显示痕迹", "ShowRevisions", 5);
            pageofficeCtrl.AddCustomToolButton("隐藏痕迹", "HiddenRevisions", 5);
            pageofficeCtrl.AddCustomToolButton("领导圈阅", "StartHandDraw", 3);
            pageofficeCtrl.AddCustomToolButton("插入键盘批注", "StartRemark", 3);
            pageofficeCtrl.AddCustomToolButton("分层显示手写批注", "ShowHandDrawDispBar", 7);
            pageofficeCtrl.AddCustomToolButton("全屏/还原", "IsFullScreen", 4);

            //设置保存页面
            pageofficeCtrl.SaveFilePage = "/Edit/SaveDoc";
            //打开Word文档
            pageofficeCtrl.WebOpen("/doc/" + fileName, PageOfficeNetCore.OpenModeType.docRevisionOnly, userName);
            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());
        }