简体   繁体   English

使用vb.net为vs2010显示.ppt /.pptx文件

[英]Display .ppt /.pptx file using vb.net for vs2010

I am using following code for displaying .pdf file but the same code is not working for .ppt / .pptx files. 我使用以下代码显示.pdf文件,但相同的代码不适用于.ppt / .pptx文件。 Need suggestions. 需要建议。

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

You need to set the correct content type for the file type you are sending: 您需要为要发送的文件类型设置正确的内容类型:

.ppt .PPT

application/vnd.ms-powerpoint

.pptx .PPTX

application/vnd.openxmlformats-officedocument.presentationml.presentation

See Office MIME Types for more reference 有关更多参考,请参阅Office MIME类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM