Marcelo Camarate
asked on
Generate a Powerpoint presentation in an ASP.NET application
Hi experts,
I have a ASP.NET/VB.NET application and I need that It generate a Powerpoint presentation. It runs on a server that does not have the Office installed.
Basically, the function should create slides, fill them with some text and embed an Excel spreadsheet in a specific slide. Then, save the presentation in .PPTX format, and if possible in .PPSX format too.
Finally, as my budget is small, the suggested solution should be free or low price. Any suggestions?
Thanks in advance,
Marcelo Camarate
I have a ASP.NET/VB.NET application and I need that It generate a Powerpoint presentation. It runs on a server that does not have the Office installed.
Basically, the function should create slides, fill them with some text and embed an Excel spreadsheet in a specific slide. Then, save the presentation in .PPTX format, and if possible in .PPSX format too.
Finally, as my budget is small, the suggested solution should be free or low price. Any suggestions?
Thanks in advance,
Marcelo Camarate
ASKER
Hi Merete,
Thanks for your reply.
But I didn't understand your suggestion very well.
Do I need to use the Apache OpenOffice Software Development Kit (SDK)? How can I integrate Apache OpenOffice SDK with my ASP.NET/VB.NET application?
Regards,
Marcelo Camarate
Thanks for your reply.
But I didn't understand your suggestion very well.
Do I need to use the Apache OpenOffice Software Development Kit (SDK)? How can I integrate Apache OpenOffice SDK with my ASP.NET/VB.NET application?
Regards,
Marcelo Camarate
Hi Camarate No,
I suggested you to consider using Open Office Impress slideshow creator instead this ASP.NET/VB.NET application? idea as I don't believe it is possible to Generate a Powerpoint presentation in an ASP.NET application as power point doesn't support it and that it also requires that your server have PowerPoint installed
2nd opinion
Is it possible to create a powerpoint file with asp.net?
Suggested 3rd party tool
Aspose.Slides for .NET is a unique PowerPoint® management component that enables .NET applications to read, write and manipulate PowerPoint documents without using Microsoft PowerPoint.
Aspose.Slides for .NET
regards Merete
I suggested you to consider using Open Office Impress slideshow creator instead this ASP.NET/VB.NET application? idea as I don't believe it is possible to Generate a Powerpoint presentation in an ASP.NET application as power point doesn't support it and that it also requires that your server have PowerPoint installed
2nd opinion
Is it possible to create a powerpoint file with asp.net?
Suggested 3rd party tool
Aspose.Slides for .NET is a unique PowerPoint® management component that enables .NET applications to read, write and manipulate PowerPoint documents without using Microsoft PowerPoint.
Aspose.Slides for .NET
regards Merete
ASKER
Hi Merete,
Thanks for your reply.
Although the Aspose.Slides is a very good product, it is very expensive. There is no other option to generate PowerPoint presentations without using Microsoft PowerPoint?
Regards,
Marcelo Camarate
Thanks for your reply.
Although the Aspose.Slides is a very good product, it is very expensive. There is no other option to generate PowerPoint presentations without using Microsoft PowerPoint?
Regards,
Marcelo Camarate
Well yes there is if you were to use CSS / PHP web language. and embed it in a page.
If there is a script possible I do not know of it since you need to program a Microsoft item such as you said here>Excel spreadsheet in a specific slide. Then, save the presentation in .PPTX format,
Please feel free to ask for assistance using the request attention at the bottom right of your original question
Maybe then we could see if there any experts who know of a way to program such a slideshow outside of office and the web.
regards Merete
If there is a script possible I do not know of it since you need to program a Microsoft item such as you said here>Excel spreadsheet in a specific slide. Then, save the presentation in .PPTX format,
Please feel free to ask for assistance using the request attention at the bottom right of your original question
Maybe then we could see if there any experts who know of a way to program such a slideshow outside of office and the web.
regards Merete
Here is what you are looking for and it is built into the .NET framework:
http://support.microsoft.com/kb/303717
Hope this helps!
-D-
http://support.microsoft.com/kb/303717
Hope this helps!
-D-
ASKER
Hi Dimante,
Thanks for your reply, but I have considerations about your suggestion.
If I using Microsoft PowerPoint Object Library and the Microsoft Graph Object Library will be need that the Microsoft Office is installed on the Web Server, right? And I do not know if my customers will permit it.
I created a small application as suggested in the article that you suggested me, as below:
The application runs fine when I run it under the Visual Basic 2013. But, when I publish it and run the web page under the IIS in my laptop (Windows 7 Home Premium), the follow error occurs:
To make sure that was not a Windows 7 Home Premium limitation, I created a virtual machine in Oracle VirtualBox with a Windows Server 2008 R2 installed to test the application too, and the same error occured.
What do I need to do for the application to be published correctly?
Regards,
Marcelo Camarate
Thanks for your reply, but I have considerations about your suggestion.
If I using Microsoft PowerPoint Object Library and the Microsoft Graph Object Library will be need that the Microsoft Office is installed on the Web Server, right? And I do not know if my customers will permit it.
I created a small application as suggested in the article that you suggested me, as below:
Imports Office = Microsoft.Office.Core
Imports Graph = Microsoft.Office.Interop.Graph
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
Imports System.IO
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim PrincipalWebFolderName As String = System.IO.Path.GetDirectoryName(System.Web.HttpContext.Current.Server.MapPath(HttpContext.Current.Request.Path()))
Dim PowerPointFilderName As String = PrincipalWebFolderName & "\PowerPoint"
Dim sTemplate As String = PowerPointFilderName & "\Model.potx"
Dim sFile As String = PowerPointFilderName & "\Presentation"
Dim sPic As String = PowerPointFilderName & "\Image.JPG"
Dim oApp As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide
Dim bAssistantOn As Boolean
'Start Powerpoint and make its window visible but minimized.
oApp = New PowerPoint.Application()
'oApp.Visible = 0
oApp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
'Create a new presentation based on the specified template.
oPres = oApp.Presentations.Open(sTemplate, , , 0)
'Build Slide #1:
'Add text to the slide, change the font and insert/position a
'picture on the first slide.
oSlide = oPres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With oSlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Sample Presentation"
.Font.Name = "Comic Sans MS"
.Font.Size = 48
End With
oSlide.Shapes.AddPicture(sPic, False, True, 150, 150, 500, 350)
oSlide = Nothing
'Build Slide #2:
'Add text to the slide title, format the text. Also add a chart to the
'slide and change the chart type to a 3D pie chart.
oSlide = oPres.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With oSlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Chart"
.Font.Name = "Comic Sans MS"
.Font.Size = 48
End With
Dim oChart As Graph.Chart
oChart = oSlide.Shapes.AddOLEObject(150, 150, 480, 320, _
"MSGraph.Chart.8").OLEFormat.Object
oChart.ChartType = Graph.XlChartType.xl3DPie
oChart = Nothing
oSlide = Nothing
'Build Slide #3:
'Add a text effect to the slide and apply shadows to the text effect.
oSlide = oPres.Slides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank)
oSlide.FollowMasterBackground = False
Dim oShape As PowerPoint.Shape
oShape = oSlide.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect27, _
"The End", "Impact", 96, False, False, 230, 200)
oShape.Shadow.ForeColor.SchemeColor = PowerPoint.PpColorSchemeIndex.ppForeground
oShape.Shadow.Visible = True
oShape.Shadow.OffsetX = 3
oShape.Shadow.OffsetY = 3
oShape = Nothing
oSlide = Nothing
'Modify the slide show transition settings for all 3 slides in
'the presentation.
Dim SlideIdx(3) As Integer
SlideIdx(0) = 1
SlideIdx(1) = 2
SlideIdx(2) = 3
With oPres.Slides.Range(SlideIdx).SlideShowTransition
.AdvanceOnTime = True
.AdvanceTime = 3
.EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut
End With
Dim oSettings As PowerPoint.SlideShowSettings
oSettings = oPres.SlideShowSettings
oSettings.StartingSlide = 1
oSettings.EndingSlide = 3
'Prevent Office Assistant from displaying alert messages.
'bAssistantOn = oApp.Assistant.On
'oApp.Assistant.On = False
'Run the slide show and wait for the slide show to end.
'oSettings.Run()
'Do While oApp.SlideShowWindows.Count >= 1
' System.Windows.Forms.Application.DoEvents()
'Loop
'oSettings = Nothing
'Reenable Office Assisant, if it was on.
'If bAssistantOn Then
' oApp.Assistant.On = True
' oApp.Assistant.Visible = False
'End If
'Close the presentation without saving changes and quit PowerPoint.
If File.Exists(sFile & ".pps") Then
File.Delete(sFile & ".pps")
End If
oPres.SaveAs(sFile, PowerPoint.PpSaveAsFileType.ppSaveAsShow)
oPres.Saved = False
oPres.Close()
oPres = Nothing
oApp.Quit()
oApp = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
End Class
The application runs fine when I run it under the Visual Basic 2013. But, when I publish it and run the web page under the IIS in my laptop (Windows 7 Home Premium), the follow error occurs:
To make sure that was not a Windows 7 Home Premium limitation, I created a virtual machine in Oracle VirtualBox with a Windows Server 2008 R2 installed to test the application too, and the same error occured.
What do I need to do for the application to be published correctly?
Regards,
Marcelo Camarate
That looks to me to be a permissions issue. When you publish the web project make sure all dlls are copied to bin. Also make sure the IUSR account has to appropriate permissions to the folder and files that are in the folder. You should not need office installed on the target.
-D-
-D-
ASKER
Hi Dimante,
Thanks for your reply, but is not working fine yet.
I checked all the application folder permissions and everything was OK. Then, I changed the anonymous user of the IIS transaction, and granted the privileges in the application folder, as can see below:
Even so, the same error occurred.
To confirm that was really a privilege problem in the application folder, I modified the application to record a text file before begin the Powerpoint file create. As you can see below, this routine is between lines 27 to 33.
Then, to my surprise, the routine to create the text file executed OK, as you can see below:
Because the error line shifted to 36 ...
... that is exactly the command "oApp = New PowerPoint.Application ()", to starts the Powerpoint.
Can you (or someone) help me, please?
Regards,
Marcelo Camarate
Thanks for your reply, but is not working fine yet.
I checked all the application folder permissions and everything was OK. Then, I changed the anonymous user of the IIS transaction, and granted the privileges in the application folder, as can see below:
Even so, the same error occurred.
To confirm that was really a privilege problem in the application folder, I modified the application to record a text file before begin the Powerpoint file create. As you can see below, this routine is between lines 27 to 33.
Imports Office = Microsoft.Office.Core
Imports Graph = Microsoft.Office.Interop.Graph
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint
Imports System.IO
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim PrincipalWebFolderName As String = System.IO.Path.GetDirectoryName(System.Web.HttpContext.Current.Server.MapPath(HttpContext.Current.Request.Path()))
Dim PowerPointFilderName As String = PrincipalWebFolderName & "\PowerPoint"
Dim sTemplate As String = PowerPointFilderName & "\Model.potx"
Dim sFile As String = PowerPointFilderName & "\Presentation"
Dim sPic As String = PowerPointFilderName & "\Image.JPG"
Dim oApp As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide
Dim bAssistantOn As Boolean
Dim tFile As String = PowerPointFilderName & "\PermissionTest.txt"
If File.Exists(tFile) Then
File.Delete(tFile)
End If
Dim fText As New StreamWriter(tFile)
fText.WriteLine("I had permission to record this file")
fText.Close()
'Start Powerpoint and make its window visible but minimized.
oApp = New PowerPoint.Application()
'oApp.Visible = 0
oApp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
'Create a new presentation based on the specified template.
oPres = oApp.Presentations.Open(sTemplate, , , 0)
'Build Slide #1:
'Add text to the slide, change the font and insert/position a
'picture on the first slide.
oSlide = oPres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With oSlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Sample Presentation"
.Font.Name = "Comic Sans MS"
.Font.Size = 48
End With
oSlide.Shapes.AddPicture(sPic, False, True, 150, 150, 500, 350)
oSlide = Nothing
'Build Slide #2:
'Add text to the slide title, format the text. Also add a chart to the
'slide and change the chart type to a 3D pie chart.
oSlide = oPres.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With oSlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Chart"
.Font.Name = "Comic Sans MS"
.Font.Size = 48
End With
Dim oChart As Graph.Chart
oChart = oSlide.Shapes.AddOLEObject(150, 150, 480, 320, _
"MSGraph.Chart.8").OLEFormat.Object
oChart.ChartType = Graph.XlChartType.xl3DPie
oChart = Nothing
oSlide = Nothing
'Build Slide #3:
'Add a text effect to the slide and apply shadows to the text effect.
oSlide = oPres.Slides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank)
oSlide.FollowMasterBackground = False
Dim oShape As PowerPoint.Shape
oShape = oSlide.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect27, _
"The End", "Impact", 96, False, False, 230, 200)
oShape.Shadow.ForeColor.SchemeColor = PowerPoint.PpColorSchemeIndex.ppForeground
oShape.Shadow.Visible = True
oShape.Shadow.OffsetX = 3
oShape.Shadow.OffsetY = 3
oShape = Nothing
oSlide = Nothing
'Modify the slide show transition settings for all 3 slides in
'the presentation.
Dim SlideIdx(3) As Integer
SlideIdx(0) = 1
SlideIdx(1) = 2
SlideIdx(2) = 3
With oPres.Slides.Range(SlideIdx).SlideShowTransition
.AdvanceOnTime = True
.AdvanceTime = 3
.EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut
End With
Dim oSettings As PowerPoint.SlideShowSettings
oSettings = oPres.SlideShowSettings
oSettings.StartingSlide = 1
oSettings.EndingSlide = 3
'Prevent Office Assistant from displaying alert messages.
'bAssistantOn = oApp.Assistant.On
'oApp.Assistant.On = False
'Run the slide show and wait for the slide show to end.
'oSettings.Run()
'Do While oApp.SlideShowWindows.Count >= 1
' System.Windows.Forms.Application.DoEvents()
'Loop
'oSettings = Nothing
'Reenable Office Assisant, if it was on.
'If bAssistantOn Then
' oApp.Assistant.On = True
' oApp.Assistant.Visible = False
'End If
'Close the presentation without saving changes and quit PowerPoint.
If File.Exists(sFile & ".pps") Then
File.Delete(sFile & ".pps")
End If
oPres.SaveAs(sFile, PowerPoint.PpSaveAsFileType.ppSaveAsShow)
oPres.Saved = False
oPres.Close()
oPres = Nothing
oApp.Quit()
oApp = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
End Class
Then, to my surprise, the routine to create the text file executed OK, as you can see below:
Because the error line shifted to 36 ...
... that is exactly the command "oApp = New PowerPoint.Application ()", to starts the Powerpoint.
Can you (or someone) help me, please?
Regards,
Marcelo Camarate
The next step is to install powerpoint on the web server to see if it does need to be installed.
ASKER
Please take a look at the following:
http://www.vbforums.com/showthread.php?657928-failed-due-to-the-following-error-80070005-Access-is-denied
That error you are receiving is permissions related. In this case it is looking like it is complus. Just use the above link as a guide. Look for Powerpoint object where is specifies Word.
-D-
http://www.vbforums.com/showthread.php?657928-failed-due-to-the-following-error-80070005-Access-is-denied
That error you are receiving is permissions related. In this case it is looking like it is complus. Just use the above link as a guide. Look for Powerpoint object where is specifies Word.
-D-
ASKER
Hi Dimante,
Sorry, but I was in a business travel in the last days of last week. Only today I came back to normal life.
I will check your suggestion and reply to you as soon as possible.
Regards,
Marcelo Camarate
Sorry, but I was in a business travel in the last days of last week. Only today I came back to normal life.
I will check your suggestion and reply to you as soon as possible.
Regards,
Marcelo Camarate
Sounds good. Let me know and we can go from there!
ASKER
Hi Dimante,
Only today could check your suggestion and I'm more confused than before.
When I run the Component Services in my windows server 2013, appears the window below that hasn't any reference to Powerpoint. Has only one reference to Excel (red outline) and a to "Office Licensing COM Server 15" (red arrow).
As the Office version installed was 2010, I decided uninstall it and install an Office 2013 in the server, but this did not change the scenario.
For your knowledge, my environment has a Windows Server 2008 R2 installed into an Oracle VM VirtualBox section. The Office 2013 package is installed on the Windows Server, as below:
Can you help me, please?
Regards,
Marcelo Camarate
Only today could check your suggestion and I'm more confused than before.
When I run the Component Services in my windows server 2013, appears the window below that hasn't any reference to Powerpoint. Has only one reference to Excel (red outline) and a to "Office Licensing COM Server 15" (red arrow).
As the Office version installed was 2010, I decided uninstall it and install an Office 2013 in the server, but this did not change the scenario.
For your knowledge, my environment has a Windows Server 2008 R2 installed into an Oracle VM VirtualBox section. The Office 2013 package is installed on the Windows Server, as below:
Can you help me, please?
Regards,
Marcelo Camarate
In that case let's simplify this. Here is the API you need to leverage:
https://powerpoint.codeplex.com/
Hope this helps!
-D-
https://powerpoint.codeplex.com/
Hope this helps!
-D-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi dimante,
Excuse me the delay but I was testing your suggestion.
The Spire.Presentation that you suggested has a free version limited to up to 10 slides per presentation. As this limit is low for me, I will need to purchase the product, which will represent a high value that was not budgeted. I needed something less expensive.
But, as Spire.Presentation worked satisfactorily in my tests, your suggestion was good. So, I'm considering the topic closed.
Regards,
Marcelo Camarate
Excuse me the delay but I was testing your suggestion.
The Spire.Presentation that you suggested has a free version limited to up to 10 slides per presentation. As this limit is low for me, I will need to purchase the product, which will represent a high value that was not budgeted. I needed something less expensive.
But, as Spire.Presentation worked satisfactorily in my tests, your suggestion was good. So, I'm considering the topic closed.
Regards,
Marcelo Camarate
There is Impress in free Open Office
http://www.openoffice.org/product/index.html
http://www.openoffice.org/
Tutorials
http://www.tutorialsforopenoffice.org/category_index/presentation.html