コード例 #1
0
        public async Task <ActionResult> SaveDoc()
        {
            String conment = "";

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

            PageOfficeNetCore.WordReader.WordDocument doc = new PageOfficeNetCore.WordReader.WordDocument(Request, Response);

            await doc.LoadAsync();

            String sName  = doc.OpenDataRegion("PO_name").Value;
            String sDept  = doc.OpenDataRegion("PO_dept").Value;
            String sCause = doc.OpenDataRegion("PO_cause").Value;
            String sNum   = doc.OpenDataRegion("PO_num").Value;
            String sDate  = doc.OpenDataRegion("PO_date").Value;

            conment += "提交的数据为:<br/>";
            conment += "姓名:" + sName + "<br/>";
            conment += "原因:" + sCause + "<br/>";
            conment += "天数:" + sNum + "<br/>";

            conment += "日期:" + sDate + "<br/>";

            await Response.Body.WriteAsync(Encoding.GetEncoding("GB2312").GetBytes(conment));

            doc.ShowPage(578, 380);
            doc.Close();
            return(Content("OK"));
        }
コード例 #2
0
        public async Task <ActionResult> SaveData()

        {
            //-----------  PageOffice 服务器端编程开始  -------------------//
            PageOfficeNetCore.WordReader.WordDocument doc = new PageOfficeNetCore.WordReader.WordDocument(Request, Response);

            await doc.LoadAsync();

            PageOfficeNetCore.WordReader.DataRegion dataReg = doc.OpenDataRegion("PO_table");
            PageOfficeNetCore.WordReader.Table      table   = dataReg.OpenTable(1);
            //输出提交的table中的数据
            //Response.Write("表格中的各个单元的格数据为:<br/><br/>");
            StringBuilder dataStr = new StringBuilder();

            for (int i = 1; i <= table.RowsCount; i++)
            {
                dataStr.Append("<div style='width:220px;'>");
                for (int j = 1; j <= table.ColumnsCount; j++)
                {
                    dataStr.Append("<div style='float:left;width:70px;border:1px solid red;'>" + table.OpenCellRC(i, j).Value + "</div>");
                }
                dataStr.Append("</div>");
            }
            //Response.Write(dataStr.ToString());
            //向客户端显示提交的数据

            await Response.Body.WriteAsync(Encoding.GetEncoding("GB2312").GetBytes(dataStr.ToString()));

            doc.ShowPage(300, 300);
            doc.Close();
            return(Content("OK"));
        }
コード例 #3
0
        public async Task <ActionResult> SaveData()
        {
            string content = "";


            PageOfficeNetCore.WordReader.WordDocument doc = new PageOfficeNetCore.WordReader.WordDocument(Request, Response);
            await doc.LoadAsync();

            //获取提交的数值
            PageOfficeNetCore.WordReader.DataRegion dataUserName = doc.OpenDataRegion("PO_userName");
            PageOfficeNetCore.WordReader.DataRegion dataDeptName = doc.OpenDataRegion("PO_deptName");
            content += "公司名称:" + doc.GetFormField("txtCompany");
            content += "<br/>员工姓名:" + dataUserName.Value;
            content += "<br/>部门名称:" + dataDeptName.Value;

            await Response.Body.WriteAsync(Encoding.GetEncoding("GB2312").GetBytes(content));

            doc.ShowPage(400, 300);
            doc.Close();
            return(Content("OK"));
        }
コード例 #4
0
        public async Task <ActionResult> SaveData()
        {
            string content = "";

            PageOfficeNetCore.WordReader.WordDocument doc = new PageOfficeNetCore.WordReader.WordDocument(Request, Response);
            await doc.LoadAsync();

            //获取提交的数值
            PageOfficeNetCore.WordReader.DataRegion poName = doc.OpenDataRegion("PO_Name");
            try
            {
                PageOfficeNetCore.WordReader.DataRegion dataDeptName = doc.OpenDataRegion("PO_deptName");
                content += "后台获取 PO_Name的值:" + poName.Value;
            }
            catch
            {
                content += "客户端提交的数据区域中没有包含名称为 PO_Name 的数据区域。";
            }
            await Response.Body.WriteAsync(Encoding.GetEncoding("GB2312").GetBytes(content));

            doc.ShowPage(400, 300);
            doc.Close();
            return(Content("OK"));
        }
コード例 #5
0
        public async Task <ActionResult> SaveData()
        {
            string ErrorMsg = "";

            PageOfficeNetCore.WordReader.WordDocument doc = new PageOfficeNetCore.WordReader.WordDocument(Request, Response);
            await doc.LoadAsync();

            string sName  = doc.OpenDataRegion("PO_name").Value;
            string sDept  = doc.OpenDataRegion("PO_dept").Value;
            string sCause = doc.OpenDataRegion("PO_cause").Value;
            string sNum   = doc.OpenDataRegion("PO_num").Value;
            string sDate  = doc.OpenDataRegion("PO_date").Value;

            if (sName == "")
            {
                ErrorMsg = ErrorMsg + "<li>申请人</li>";
            }
            if (sDept == "")
            {
                ErrorMsg = ErrorMsg + "<li>部门名称</li>";
            }
            if (sCause == "")
            {
                ErrorMsg = ErrorMsg + "<li>请假原因</li>";
            }
            if (sDate == "")
            {
                ErrorMsg = ErrorMsg + "<li>日期</li>";
            }

            try
            {
                if (sNum != "")
                {
                    if (Int64.Parse(sNum) < 0)
                    {
                        ErrorMsg = ErrorMsg + "<li>请假天数不能是负数</li>";
                    }
                }
                else
                {
                    ErrorMsg = ErrorMsg + "<li>请假天数</li>";
                }
            }
            catch (Exception Ex)
            {
                ErrorMsg = ErrorMsg + "<li><font color=red>注意:</font>请假天数必须是数字</li>";
            }

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

            if (ErrorMsg == "")
            {
                sql = "update leaveRecord set Name='" + sName
                      + "', Dept='" + sDept + "', Cause='" + sCause
                      + "', Num=" + sNum + ", SubmitTime='" + sDate
                      + "' where  ID=" + id;
                SqliteConnection conn = new SqliteConnection(connString);
                conn.Open();
                SqliteCommand cmd = new SqliteCommand(sql, conn);
                cmd.ExecuteNonQuery();
                conn.Close();
            }
            else
            {
                await Response.Body.WriteAsync(Encoding.GetEncoding("GB2312").GetBytes(ErrorMsg));

                doc.ShowPage(578, 380);
            }
            doc.Close();
            return(Content("OK"));
        }