Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     fs.SaveToFile(Server.MapPath("doc/") + "test3.doc");
     fs.CustomSaveResult = "ok";
     fs.Close();
 }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        string id = Request.QueryString["id"];

        if (id != null && id.Length > 0)
        {
            string          strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo_paper.mdb";
            OleDbConnection conn    = new OleDbConnection(strConn);
            byte[]          aa      = fs.FileBytes;

            OleDbCommand cm = new OleDbCommand();
            cm.Connection  = conn;
            cm.CommandType = CommandType.Text;
            if (conn.State == 0)
            {
                conn.Open();
            }
            cm.CommandText = "UPDATE  Stream SET Word=@file WHERE ID=" + id;
            OleDbParameter spFile = new OleDbParameter("@file", OleDbType.Binary);
            spFile.Value = aa;
            cm.Parameters.Add(spFile);
            cm.ExecuteNonQuery();
            conn.Close();

            //向客户端控件返回以上代码执行成功的消息。
            fs.CustomSaveResult = "ok";
        }
        else
        {
            Page.RegisterClientScriptBlock("", "<script>alert('未获得文件的ID,保存失败!');location.href='Default.aspx'</script>");
        }
        fs.Close();
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        PageOffice.FileSaver fs = new PageOffice.FileSaver();

        string sID        = Request.QueryString["id"];
        string connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo_database.mdb";

        OleDbConnection conn = new OleDbConnection(connstring);

        conn.Open();

        byte[] aa = fs.FileBytes;

        OleDbCommand cm = new OleDbCommand();

        cm.Connection  = conn;
        cm.CommandType = CommandType.Text;
        if (conn.State == 0)
        {
            conn.Open();
        }
        cm.CommandText = "UPDATE  Stream SET Word=@file WHERE ID=" + sID;
        OleDbParameter spFile = new OleDbParameter("@file", OleDbType.Binary);

        spFile.Value = aa;
        cm.Parameters.Add(spFile);
        cm.ExecuteNonQuery();
        conn.Close();

        fs.Close();
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //定义FileSaver对象
        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString().Trim().Length > 0)
        {
            string          id      = Request.QueryString["id"].ToString().Trim();
            string          content = fs.DocumentText;
            string          strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo_search.mdb";
            string          sql     = " update word set Content = '" + content + "' where id= " + id;
            OleDbConnection conn    = new OleDbConnection(strConn);
            OleDbCommand    cmd     = new OleDbCommand(sql, conn);
            conn.Open();
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            //将文档内容保存到本地磁盘的Word文档中,fs.FileName指代Edit.aspx.cs页面中打开的Word文件名
            fs.SaveToFile(Server.MapPath("doc/") + fs.FileName);
            //设置保存返回值
            fs.CustomSaveResult = "ok";
        }
        else
        {
            //设置保存返回值
            fs.CustomSaveResult = "未获得文档编号ID";
        }

        //关闭FileSaver对象
        fs.Close();
    }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     fs.SaveToFile(Server.MapPath("doc/1.doc"));
     //fs.SaveToFile(Server.MapPath("doc/") + fs.FileName);
     fs.Close();
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     fs.SaveToFile(Server.MapPath("/Public/File/test/") + fs.FileName);
     //保存成功后,设置返回值,此处设置为:OK
     fs.CustomSaveResult = "OK";
     fs.Close();
 }
Пример #7
0
        /// <summary>
        /// 平台修订
        /// </summary>>
        public void SaveFile(string filename)
        {
            string uploadDir = Server.MapPath(string.Format("~/Resource/ExcelTemplate/SelfReport/{0}", HttpUtility.HtmlDecode(filename)));

            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            fs.SaveToFile(uploadDir);
            fs.Close();
        }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        string fileName         = "maker" + fs.FileExtName;

        fs.SaveToFile(Server.MapPath("doc/") + fileName);
        fs.Close();
    }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     fs.SaveToFile(Server.MapPath("Public/File/protocol/") + fs.FileName);
     //保存成功后,设置返回值,此处设置为:OK
     fs.CustomSaveResult = "OK";
     fs.Close();
 }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        string subject          = fs.GetFormField("FileSubject");
        string newFileName      = Insert(subject);//向数据库插入文件记录并获取返回的文件名

        fs.SaveToFile(Server.MapPath("doc/") + newFileName);
        fs.Close();
    }
Пример #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //定义FileSaver对象
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     //保存Word文件
     fs.SaveToFile(Server.MapPath("doc/") + fs.FileName);
     //关闭FileSaver对象
     fs.Close();
 }
Пример #12
0
        public void SaveDoc()
        {
            ViewBag.Message = "Your app description page.";
            string filePath = Server.MapPath("/test.doc");

            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            fs.SaveToFile(filePath);
            fs.Close();
        }
Пример #13
0
        /// <summary>
        /// 保存在线修改的office文件
        /// 作者:章建国
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveDoc(string filename)
        {
            ViewBag.Message = "Your app description page.";
            string filePath = AppDomain.CurrentDomain.BaseDirectory + "UpFile//" + filename;

            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            fs.SaveToFile(filePath);
            fs.Close();
            return(View());
        }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //定义FileSaver对象
        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        fs.SaveToFile(Server.MapPath("doc/") + fs.FileName);


        //获取通过Url传递过来的值
        if (Request.QueryString["id"] != null && Request.QueryString["id"].Trim().Length > 0)
        {
            id = int.Parse(Request.QueryString["id"].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");
        }

        string          connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo_param.mdb";
        OleDbConnection conn       = new OleDbConnection(connstring);

        conn.Open();

        string       strsql;
        OleDbCommand cmd = new OleDbCommand();

        cmd.Connection  = conn;
        cmd.CommandType = CommandType.Text;
        strsql          = "Update Users set UserName = '******', age = " + age + ",sex = '" + sex + "' where id = " + id;
        cmd.CommandText = strsql;
        cmd.ExecuteNonQuery();
        conn.Close();

        fs.ShowPage(300, 200); // 显示一下SaveFile.aspx获取到的所有参数的值
        //关闭FileSaver对象
        fs.Close();
    }
Пример #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     if (fs.FileExtName.Equals(".jpg"))
     {
         fs.SaveToFile(Server.MapPath("images/") + fs.FileName);
     }
     else
     {
         fs.SaveToFile(Server.MapPath("doc/") + fs.FileName);
     }
     fs.CustomSaveResult = "ok";
     fs.Close();
 }
Пример #16
0
        public ActionResult SaveDoc(int id)
        {
            var file = Core.FileManager.GetModel(id);

            if (file == null)
            {
                throw new Exception("文件未找到");
            }
            var fs = new PageOffice.FileSaver();

            fs.SaveToFile(file.AbsolutelyPath);
            fs.Close();
            return(View());
        }
Пример #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var extionName = string.IsNullOrEmpty(Request.QueryString["extion"]) ? ".doc" : Request.QueryString["extion"];
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     string path = ("/UploadFile/ContributeInfo/ContributePath/PageOffice/").Replace("//", "/");
     string uploadPath = GetFullPath(path);
     string filename = Path.ChangeExtension(Path.GetRandomFileName(), extionName);
     string url = Path.Combine(uploadPath, filename);
     if (!Directory.Exists(uploadPath))
         Directory.CreateDirectory(uploadPath);
     fs.SaveToFile(url);
     //保存成功后,设置返回值,此处设置为:OK
     fs.CustomSaveResult = Path.Combine(path, filename);
     fs.Close();
 }
        /// <summary>
        /// 在线保存
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveDoc()
        {
            string filePath = System.Configuration.ConfigurationManager.AppSettings["FireReportPath"].ToString();
            string fullpath = Server.MapPath(filePath);

            if (!Directory.Exists(fullpath))
            {
                Directory.CreateDirectory(fullpath);
            }
            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            filePath += "/" + "sc_" + DateTime.Now.ToString("yyyyMMddHHmmss") + fs.FileExtName;
            fs.SaveToFile(Server.MapPath(filePath));
            fs.Close();
            return(null);
            //return Content("<script> alert('已保存')</script>");
            //return Content("alert('文档已保存');", "application/x-javascript");
        }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];

        if (id != null && id.Length > 0)
        {
            //定义FileSaver对象
            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            string fileName         = "maker" + id + fs.FileExtName;
            //将Word文档保存到本地磁盘上
            fs.SaveToFile(Server.MapPath("doc/") + fileName);
            fs.Close();
        }
        else
        {
            this.Page.RegisterClientScriptBlock("", "<script>alert('未获得文件名称');</script>");
        }
    }
Пример #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var extionName = string.IsNullOrEmpty(Request.QueryString["extion"]) ? ".doc" : Request.QueryString["extion"];

        PageOffice.FileSaver fs = new PageOffice.FileSaver();
        string path             = ("/UploadFile/ContributeInfo/ContributePath/PageOffice/").Replace("//", "/");
        string uploadPath       = GetFullPath(path);
        string filename         = Path.ChangeExtension(Path.GetRandomFileName(), extionName);
        string url = Path.Combine(uploadPath, filename);

        if (!Directory.Exists(uploadPath))
        {
            Directory.CreateDirectory(uploadPath);
        }
        fs.SaveToFile(url);
        //保存成功后,设置返回值,此处设置为:OK
        fs.CustomSaveResult = Path.Combine(path, filename);
        fs.Close();
    }
Пример #21
0
        public ActionResult SaveFile(string id)
        {
            string filePath = string.Empty;

            if (!string.IsNullOrWhiteSpace(id) && id.Contains(".."))
            {
                filePath = Server.MapPath(id.Replace("..", "~"));
            }
            else
            {
                filePath = Server.MapPath(id);
            }
            //LogClassModels.WriteServiceLog(Suggestion.InsertFail + filePath+",相位的信息888," + id, "相位"
            //          );//写入日志
            PageOffice.FileSaver fs = new PageOffice.FileSaver();
            //LogClassModels.WriteServiceLog(Suggestion.InsertFail + filePath + ",相位的信息8883," + id, "相位"
            //        );//写入日志
            fs.SaveToFile(filePath);
            fs.Close();
            //LogClassModels.WriteServiceLog(Suggestion.InsertFail + filePath + ",相位的信息88838," + id, "相位"
            //        );//写入日志
            return(View());
        }
Пример #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PageOffice.FileSaver fs = new PageOffice.FileSaver();
     fs.SaveToFile("D:\\project\\pageOffice\\test\\" + fs.FileName);
     fs.Close();
 }