Ejemplo n.º 1
0
        private void ExportWord()
        {
            WordHelper helper = new WordHelper();
            String     file   = Server.MapPath("/resource/sciProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String         F_ID       = Session[SessionMgm.SciProjectID].ToString();
            ScienceProject project    = dc.ScienceProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            if (project != null)
            {
                fillContent(helper, project);
            }
            project.F_name = UtilHelper.getValidatePath(project.F_name);
            String fileName = Server.MapPath("/resource/" + project.F_name + ".doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "Application/msword";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(project.F_name) + ".doc");
            Response.TransmitFile(fileName);
            Response.Flush();
            Response.Close();
            Response.End();
        }
Ejemplo n.º 2
0
        private void ExportWord()
        {
            HttpResponse Response = context.Response;
            WordHelper   helper   = new WordHelper();
            String       file     = context.Server.MapPath("/resource/sciProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String         F_ID       = paras["id"].ToString();
            ScienceProject project    = dc.ScienceProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            if (project != null)
            {
                fillContent(helper, project);
            }

            String fileName = context.Server.MapPath("/resource/projectName.doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.Clear();
        }
Ejemplo n.º 3
0
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            WordHelper helper = new WordHelper();
            String     file   = Server.MapPath("/resource/socialProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String        F_ID        = (sender as LinkButton).CommandArgument;
            SocialProject project     = dc.SocialProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            fillContent(helper, project);
            fillParticipants(helper, project);
            fillAudit(helper, project);
            project.F_name = UtilHelper.getValidatePath(project.F_name);
            String fileName = Server.MapPath("/resource/" + project.F_name + ".doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.HtmlEncode(Path.GetFileName(fileName)));
            Response.TransmitFile(fileName);
            Response.End();
        }