我一直在尝试找出在Intranet上显示电源点的最佳方式。该公司的用户将不是非常技术性的,可能不会遵循我将描述的流程。
我找到了这个page
它显示了如何将power point转换为可查看的html页面。我想知道是否有一些方法可以自动化这个过程。例如,文件监视器监视它将保存的位置,然后一旦看到它,就会使用我给出的页面上提供的代码自动将其更改为html。首选的语言是VB.NET。
我很高兴人们能给我任何建议。
提前感谢
发布于 2012-10-01 10:40:51
我已经使用了:
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
能够自动将电源插入点更改为HTML。我已经使用了一个文件监视器来监视我计算机上的一个目录,以查看power point演示文稿,目前它只被设置为.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文档。它还将获得运行所需的文件,因此如果保存了任何动画,它也会保留这些文件。
发布于 2012-09-28 15:38:19
您可以尝试使用基于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
https://stackoverflow.com/questions/12643024
复制相似问题