Creating Power Point presentation on the fly with VB.NET

B

Boots

Hi,

I'm creating a power point on the fly using VB.NET. The power point has
10 sheets with approx 500 text boxs in total. The problem I'm having is
performance. On one sheet I'm creating 130 boxs its taking approx 40
seconds to draw. Unfortunatly this is unacceptabe to the end user.

The code I'm using to add and format a text box is as follows:

Can anyone please help ? how can I increase performance ? what options
are open to me using VB.NET to create a powerpoint ?

Thanks,

Sub DrawPPTTextBoxFromControl(ByVal objSlide As PowerPoint.Slide, ByRef
objControl As Control)


Dim objNewObject

objNewObject =
objSlide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal,
objControl.Left, objControl.Top, objControl.Width, objControl.Height)

With objNewObject.TextFrame
' If blnWordwrap Then
.WordWrap = Office.MsoTriState.msoTrue
' Else
' .WordWrap = Office.MsoTriState.msoFalse
' End If
With .TextRange
If objControl.Text = "" Then
.Text = " "
Else
.Text = objControl.Text
End If
With .ParagraphFormat
' .Alignment
'.SpaceWithin = intParagraphSpacing
' .WordWrap = Office.MsoTriState.msoTrue
' .Bullet = blnBullet
End With
With .Font
.Name = objControl.Font.Name
.Size = objControl.Font.Size
.Bold = objControl.Font.Bold
.Italic = objControl.Font.Italic
.Underline = objControl.Font.Underline

End With
End With
End With
objNewObject.Visible = Office.MsoTriState.msoTrue
objNewObject = Nothing
End Sub
 
C

ckeppel

It appears creating Powerpoint presentations using VB6 or VB.NET is
pretty slow. What I did to improve performance was to write each
TextBox/Picture/Shapes/Table properties to an XML file. Then using a
Macro in Powerpoint read in the XML file and create the necessary
controls in Powerpoint.

A 9page/500 textbox presentation took 2 minutes to create in VB.NET now
takes 10 seconds in Powerpoint.

Thanks for all the suggestions.
Boots.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top