我使用以下代码显示.pdf文件,但相同的代码不适用于.ppt / .pptx文件。需要建议。
If file.Name.Contains(Left(lblMth.Text, 3) & lblYr.Text) Then
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Dim path As String = file.FullName 'strLine & GridView1.Rows(index).Cells(1).Text()
Dim client As New WebClient()
Dim buffer As [Byte]() = client.DownloadData(path)
If buffer IsNot Nothing Then
Response.ContentType = "application/pdf"
Response.AddHeader("content-length", buffer.Length.ToString())
Response.BinaryWrite(buffer)
End If
End If
答案 0 :(得分:0)
您需要为要发送的文件类型设置正确的内容类型:
<强> .PPT 强>
application/vnd.ms-powerpoint
<强> .PPTX 强>
application/vnd.openxmlformats-officedocument.presentationml.presentation
有关详情,请参阅Office MIME Types