[英]Why can't I convert an Excel file to an image using Spire.Xls in Linux?
[英]Why can't I open xls file in browser using TransmitFile?
我使用Response.TransmitFile()
打開.XLS/.DOC/.PDF
文件。 打開了PDF
,但未打開XLS
和DOC
文件。
string path = @"D:\\Files\\" + Request.QueryString.Get("PSFname");
int startIndex = Request.QueryString.Get("PSFname").IndexOf(".");
string type = Request.QueryString.Get("PSFname").Substring(startIndex + 1);
if (type == "doc" || type == "docx")
{
Response.ContentType = "application/ms-word";
}
else if (type == "xls" || type == "xlsx")
{
Response.ContentType = "application/x-msexcel";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Request.QueryString.Get("PSFname"));
}
else if (type == "pdf" || type == "PDF")
{
Response.ContentType = "Application/pdf";
}
Response.TransmitFile(path);
在這里,您可以在瀏覽器中打開PDF文件,因為您在瀏覽器中添加了pdf文件的附件,從而在瀏覽器中為您打開了pdf文件。
但是,對於Word和Excel文件,沒有任何相同的加載項。 因此這些文件不會在瀏覽器中打開。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.