A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

programmatically insert lots of text into a power point presentation.



 
 
Thread Tools Display Modes
  #1  
Old June 24th, 2004, 11:16 PM
Scott Jacobsen
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

I have a situation where I would like to write VB code to insert an
arbitrary amount of text into a power point presentation. The amount
of text will change, so I don't know how many pages it will need to
span. Is there a way to tell PowerPoint to break it up over multiple
pages? If not, does anyone have any suggestions on how to
programmatically calculate how many lines per page I'll need given a
specific font?
--
TIA
Scott
  #2  
Old June 25th, 2004, 03:19 AM
Bill Dilworth
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

Well ....

Do you really need to have the program calculate the actual size of the
output, or could you instead tell it to span to the next slide after x
number of pre-formatted lines? If you are importing the text into a known
slide format, then you only need to know that beyond a certain point, you
will need to continue on the next slide.

Are you using this in a presentation? or are you using this to publish
hardcopies? If you are doing this for a presentation, I would strongly urge
you to reconsider placing large amounts of text on the screen. Either you
will end up reading it to the audience (a major pain point for anyone who
has to endure this) or run the risk of them not reading it on their own or
worse, having people ignore your speaking in favor of reading the slide.
Large amounts of text usually do best when added to a handout instead of
displayed on the screen. Can you summarize the major key points instead?

If you are using this for publishing to a paper printout, then MS Word does
this much better then PowerPoint. If this is for a web page, perhaps a
program designed for that purpose, like FrontPage, may be better.

Post back if you still need the macro to break the over-sized textboxes onto
multiple slides based on the number of lines in the textbox.


--
Bill Dilworth, Microsoft PPT MVP
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..


"Scott Jacobsen" wrote in message
om...
I have a situation where I would like to write VB code to insert an
arbitrary amount of text into a power point presentation. The amount
of text will change, so I don't know how many pages it will need to
span. Is there a way to tell PowerPoint to break it up over multiple
pages? If not, does anyone have any suggestions on how to
programmatically calculate how many lines per page I'll need given a
specific font?
--
TIA
Scott



  #3  
Old June 25th, 2004, 03:56 PM
Mike M.
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

I do this using C++. I have a one slide template that contains one or more
text boxes where I want the text to go. My program reads text from a file
and puts it in the text boxes. If the text would go off the slide I copy
the template slide and paste it into my presentation I am building and start
adding text in it. Is this what you are talking about?

"Scott Jacobsen" wrote in message
om...
I have a situation where I would like to write VB code to insert an
arbitrary amount of text into a power point presentation. The amount
of text will change, so I don't know how many pages it will need to
span. Is there a way to tell PowerPoint to break it up over multiple
pages? If not, does anyone have any suggestions on how to
programmatically calculate how many lines per page I'll need given a
specific font?
--
TIA
Scott



  #4  
Old June 25th, 2004, 04:12 PM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

In article , Scott Jacobsen
wrote:
I have a situation where I would like to write VB code to insert an
arbitrary amount of text into a power point presentation. The amount
of text will change, so I don't know how many pages it will need to
span. Is there a way to tell PowerPoint to break it up over multiple
pages? If not, does anyone have any suggestions on how to
programmatically calculate how many lines per page I'll need given a
specific font?


Will the size of the text box containing the text and the line spacing be
constant? If so, it might be good enough for gummint work to work out how many
characters will fit the text box w/o overflowing the slide.

Alternatively, it might work to add a line of text at a time then check the
size of the text box you're adding the text to. When it gets too close to the
"safety zone" you've defined, it's time to move on to a new slide.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

  #5  
Old June 25th, 2004, 11:53 PM
Scott Jacobsen
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

"Bill Dilworth" wrote in message ...

Do you really need to have the program calculate the actual size of the
output, or could you instead tell it to span to the next slide after x
number of pre-formatted lines? If you are importing the text into a known
slide format, then you only need to know that beyond a certain point, you
will need to continue on the next slide.

The input text is a bunch of one or two sentence long phrases. There
are lots of these phrases, and no way to know what they are in
advance. So it will take more than one slide to display them.

I suppose I can figure out how many physical lines of text will fit on
one slide for a given font just by opening up PP and typing in lines.
That's easy enough.

But one input phrase doesn't == one line of text, because it might
word wrap. I could count the number of characters that fit on one
physical line. Then I could assume a phrase will wrap at the last
whitespace character = the max number of chars per line.

But I'm hoping there is some way for pp to do this for me, or at least
just tell me how many lines are in a text box.

Are you using this in a presentation? or are you using this to publish

It is a requirement of an existing application. I'm just the grunt
coder who has to do it

Post back if you still need the macro to break the over-sized textboxes onto
multiple slides based on the number of lines in the textbox.

That macro would be great.

Thanks

--
Scott
  #6  
Old June 26th, 2004, 01:28 AM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

I suppose I can figure out how many physical lines of text will fit on
one slide for a given font just by opening up PP and typing in lines.
That's easy enough.

But one input phrase doesn't == one line of text, because it might
word wrap. I could count the number of characters that fit on one
physical line. Then I could assume a phrase will wrap at the last
whitespace character = the max number of chars per line.

But I'm hoping there is some way for pp to do this for me, or at least
just tell me how many lines are in a text box.


This should do you. Knowing the font height and line spacing, you should be in good shape:


Function LineCount(oSh As Shape) As Long

' return zero if no text, -1 if error
LineCount = 0
On Error GoTo ErrorHandler
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
LineCount = .TextFrame.TextRange.Lines.Count
End If
End If
End With

NormalExit:
Exit Function
ErrorHandler:
LineCount = -1
Resume NormalExit

End Function

Sub TestLineCount()
' Use currently selected shape
Debug.Print LineCount(ActiveWindow.Selection.ShapeRange(1))

End Sub








Are you using this in a presentation? or are you using this to publish

It is a requirement of an existing application. I'm just the grunt
coder who has to do it

Post back if you still need the macro to break the over-sized textboxes onto
multiple slides based on the number of lines in the textbox.

That macro would be great.

Thanks


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

  #7  
Old June 26th, 2004, 02:08 AM
Bill Dilworth
external usenet poster
 
Posts: n/a
Default programmatically insert lots of text into a power point presentation.

That macro would be great.
Thanks
Scott


This macro will check the number of LINES in the text placeholder and if it
is over the number you select, it will copy the overflow to a new slide.

========Begin Macro Code=============
Option Explicit

Sub WrapOver()

Dim SldCnt As Integer
Dim SldNum As Integer
Dim WrapCnt As Integer
Dim OldCnt As Integer

SldCnt = ActivePresentation.Slides.Count
OldCnt = SldCnt
WrapCnt = InputBox("'Wrap' text in placeholder " & _
"if they exceed how many lines?", "Wrap after" & _
"input", "6")

If WrapCnt 15 Or WrapCnt 2 Then
MsgBox "Please enter a number between 2 and 1" & _
"5, when you re-run this macro", vbCritical + _
vbOKOnly, "Input range error"
Exit Sub
End If

SldNum = 0

With ActivePresentation

NextSlide:
SldNum = SldNum + 1
If SldNum SldCnt Then GoTo EndRoutine

If .Slides(SldNum).Shapes.Placeholders(2) _
.TextFrame.TextRange.Lines _
.Count = WrapCnt Then GoTo NextSlide

.Slides(SldNum).Duplicate
SldCnt = SldCnt + 1

With .Slides(SldNum).Shapes.Placeholders(2) _
.TextFrame.TextRange
.Lines(WrapCnt + 1, .Lines.Count).Delete
End With
With .Slides(SldNum + 1).Shapes.Placeholders(2) _
.TextFrame.TextRange
.Lines(1, WrapCnt).Delete
End With
GoTo NextSlide

EndRoutine:
End With
MsgBox "Task complete. " & SldCnt - OldCnt & _
" slides were added.", vbOKOnly, WrapCnt & _
" line max. macro"
End Sub
========End Macro Code=============


If this does 1/2 your work, do I get 1/2 your paycheck?

--
Bill Dilworth, Microsoft PPT MVP
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
saving power point presentation to CD-RW Lori Powerpoint 15 January 12th, 2007 12:53 AM
Power Point to EXE Kartik Powerpoint 1 June 23rd, 2004 07:12 PM
insert text in arrow lines problem Matt New Users 4 May 26th, 2004 06:56 AM
Can I insert Cell ref into text output Jamie Worksheet Functions 1 October 8th, 2003 09:51 AM


All times are GMT +1. The time now is 04:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.