我一直在尝试找出在内联网上显示电源点的最佳方法。公司的用户不会非常技术化,也可能不遵循我将描述的流程。
我发现了page
其中显示了如何将电源点转换为可以查看的html页面。我想知道是否有某种方法来自动化这个过程。比如文件观察者观看它将保存的位置,然后一看到它就会自动将其更改为使用我提供的页面上提供的代码的html。首选语言是VB.NET。
我很高兴有人能给出的任何建议。
提前致谢
答案 0 :(得分:1)
您可以尝试使用此代码 - 基于Microsoft.Office.Interop.PowerPoint.Application
您有代码示例以尝试功能
查看Aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetPowerPointConvertToHTML.aspx.vb" Inherits="AspNetPowerPointConvertToHTML" %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="server"></asp:Label>
</form>
</body>
</html>
背后的代码
Imports Microsoft.Office.Interop.PowerPoint
Public Class AspNetPowerPointConvertToHTML
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ppApp As New Microsoft.Office.Interop.PowerPoint.Application
Dim ppName As String = "MySlides.ppt"
Dim FileName As String = "MyPP/MyPPt"
ppApp.Visible = True
ppApp.Presentations.Open(Server.MapPath(ppName))
ppApp.ActivePresentation.SaveAs(Server.MapPath(FileName), 13)
ppApp.Quit()
ppApp = Nothing
Me.lblText.Text = "PowerPoint Created to Folder <strong> " & FileName & "</strong>"
End Sub
End Class
答案 1 :(得分:0)
我用过:
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
能够自动将功率点更改为HTML。我已经使用文件观察程序来查看计算机上的目录,以便在它设置为.pptx时查看功率点演示,但是我会更改它以尽快添加其他格式。这个fileWater坐在计算机启动时启动的服务上。然后它会查看是否已创建或修改了powerpoint并运行此代码:
Private Shared Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
'set varaibles so that html can save in correct place
Dim destinationDirectory As String = e.FullPath.Replace(e.Name.ToString(), "")
Dim sourceLocation As String
Dim fileName As String
'couple of if statements to get rid of unwanted characters
If e.Name.Contains("~$") Then
fileName = e.Name.Replace("~$", "")
fileName = fileName.Replace(".pptx", ".html")
Else
fileName = e.Name
fileName = fileName.Replace(".pptx", ".html")
End If
If e.FullPath.Contains(("~$")) Then
sourceLocation = e.FullPath.Replace("~$", "")
Else
sourceLocation = e.FullPath
End If
Dim strSourceFile As String = sourceLocation 'set source location after removing unwanted characters
Dim strDestinationFile As String = destinationDirectory & fileName 'set the destination location with the directory and file name
'set ppAPP to a power point application
Dim ppApp As PowerPoint.Application = New PowerPoint.Application
Dim prsPres As PowerPoint.Presentation = ppApp.Presentations.Open(strSourceFile, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse)
'Call the SaveAs method of Presentaion object and specify the format as HTML
prsPres.SaveAs(strDestinationFile, PowerPoint.PpSaveAsFileType.ppSaveAsHTML, MsoTriState.msoTrue)
'Close the Presentation object
prsPres.Close()
'Close the Application object
ppApp.Quit()
End Sub
这将获取已修改的文件并将其另存为html文档。它还将获取运行所需的文件,因此如果已保存任何动画,它也将保留这些文件。