public async Task <ActionResult> SaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);

            await fs.LoadAsync();

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

            string sql = "UPDATE  Stream SET Word=@file WHERE ID=" + sID;

            using (SqliteConnection conn = new SqliteConnection(connString))
            {
                conn.Open();
                byte[] aa = fs.FileBytes;

                using (SqliteCommand cmd = new SqliteCommand(sql, conn))
                {
                    SqliteParameter parameter = new SqliteParameter("@file", SqliteType.Blob);
                    parameter.Value = aa;
                    cmd.Parameters.Add(parameter);
                    cmd.ExecuteNonQuery();
                }
            }
            fs.Close();
            return(Content("OK"));
        }
        public async Task <ActionResult> SaveDoc()
        {
            int    id       = 0;
            string userName = "";
            int    age      = 0;
            string sex      = "";

            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            //await fs.LoadAsync();
            string webRootPath = _webHostEnvironment.WebRootPath;

            fs.SaveToFile(webRootPath + "/SendParameters/doc/" + fs.FileName);

            //获取通过Url传递过来的值
            string message = Request.Query["id"];

            if (message != null && message.Trim().Length > 0)
            {
                id = int.Parse(message.Trim());
            }

            //获取通过网页标签控件传递过来的参数值,注意fs.GetFormField("HTML标签的name名称")方法中的参数名是指标签的“name”属性而不是Id

            //获取通过文本框<input type="text" />标签传递过来的值
            if (fs.GetFormField("userName") != null && fs.GetFormField("userName").Trim().Length > 0)
            {
                userName = fs.GetFormField("userName");
            }

            //获取通过隐藏域传递过来的值
            if (fs.GetFormField("age") != null && fs.GetFormField("age").Trim().Length > 0)
            {
                age = int.Parse(fs.GetFormField("age"));
            }

            //获取通过<select>标签传递过来的值
            if (fs.GetFormField("selSex") != null && fs.GetFormField("selSex").Trim().Length > 0)
            {
                sex = fs.GetFormField("selSex");
            }

            fs.ShowPage(300, 200); // 显示一下SaveFile.aspx获取到的所有参数的值

            fs.Close();

            string content = "";

            content += "传递的参数为:<br />";
            content += " userName:"******"<br />";
            content += " id:" + id + "<br />";
            content += " age:" + age + "<br />";
            content += " sex:" + sex + "<br />";

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

            return(View());
        }
示例#3
0
        public async Task <ActionResult> SaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string webRootPath = _webHostEnvironment.WebRootPath;

            fs.SaveToFile(webRootPath + "/SimplePPT/doc/" + fs.FileName);
            fs.Close();
            return(Content("OK"));
        }
示例#4
0
        public async Task <ActionResult> SaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string webRootPath = _webHostEnvironment.WebRootPath;

            fs.SaveToFile(webRootPath + "/InsertPageBreak2/doc/" + "test3.doc");
            fs.CustomSaveResult = "ok";
            fs.Close();
            return(Content("OK"));
        }
示例#5
0
        public async Task <ActionResult> SaveDoc()
        {
            string id = Request.Query["id"];

            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string fileName    = "maker" + id + fs.FileExtName;
            string webRootPath = _webHostEnvironment.WebRootPath;

            fs.SaveToFile(webRootPath + "/PrintFiles/doc/" + fileName);
            fs.Close();
            return(Content("OK"));
        }
示例#6
0
        public async Task <ActionResult> POSaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string webRootPath     = _webHostEnvironment.WebRootPath;
            string contentRootPath = _webHostEnvironment.ContentRootPath;

            fs.SaveToFile(webRootPath + "/POBrowser/doc/" + fs.FileName);

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



            fs.ShowPage(300, 300);
            fs.Close();
            return(Content("OK"));
        }
        public async Task <ActionResult> SaveDoc()
        {
            string type = Request.Query["type"].ToString();

            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string webRootPath = _webHostEnvironment.WebRootPath;

            if ("2" == type)
            {
                fs.SaveToFile(webRootPath + "/doc/" + "filemaker.doc");
            }
            else
            {
                fs.SaveToFile(webRootPath + "/doc/" + fs.FileName);
            }
            fs.Close();
            return(Content("OK"));
        }
示例#8
0
        public async Task <ActionResult> SaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string webRootPath = _webHostEnvironment.WebRootPath;

            if (fs.FileExtName.Equals(".jpg"))
            {
                fs.SaveToFile(webRootPath + "/SaveFirstPageAsImg/images/" + fs.FileName);
            }
            else
            {
                fs.SaveToFile(webRootPath + "/SaveFirstPageAsImg/doc/" + fs.FileName);
            }

            fs.CustomSaveResult = "ok";
            fs.Close();

            return(Content("OK"));
        }
示例#9
0
        public async Task <ActionResult> SaveDoc()
        {
            PageOfficeNetCore.FileSaver fs = new PageOfficeNetCore.FileSaver(Request, Response);
            await fs.LoadAsync();

            string id      = Request.Query["id"].ToString().Trim();
            string content = fs.DocumentText;

            SqliteConnection conn = new SqliteConnection(connString);

            conn.Open();
            string        sql = "update word set Content='" + content + "' where id=" + id;
            SqliteCommand cmd = new SqliteCommand(sql, conn);

            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            string webRootPath = _webHostEnvironment.WebRootPath;

            fs.SaveToFile(webRootPath + "/SaveAndSearch/doc/" + fs.FileName);
            fs.Close();
            return(Content("OK"));
        }