簡體   English   中英

使用vb.net為vs2010顯示.ppt /.pptx文件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM