[英]Display .ppt /.pptx file using vb.net for vs2010
我使用以下代码显示.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
您需要为要发送的文件类型设置正确的内容类型:
.PPT
application/vnd.ms-powerpoint
.PPTX
application/vnd.openxmlformats-officedocument.presentationml.presentation
有关更多参考,请参阅Office MIME类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.