0
    [HttpPost]
    public ActionResult ExportTableToExcel(string htmlTable)
    {
        EFWPResponse Result = new EFWPResponse() { RequestStatus = false };

        try
        {
             Response.AppendHeader("content-disposition", "attachment;filename=FileEName.xls");
             Response.Charset = "";
             Response.Cache.SetCacheability(HttpCacheability.NoCache);
             Response.ContentType = "application/vnd.ms-excel";
             //this.EnableViewState = false;
             Response.Write(htmlTable);
             Response.End();
        }
        catch (Exception ex)
        {
            ModelState.AddModelError("", ex);
        }
        return Json(Result);
    }

// コードは正常に実行されますが、Excel ファイルは開きません。// jquery を使用して C# で開く Excel ファイルを生成する方法を教えてください。

4

0 に答える 0