Problem again: Just do not understand how to edit texts?!?!


#1

Hi, am I stupid or this a new bug: I just cannot get hold of the text places in my ppt template. This is the code I use:

Dim slides As Slides = pptPresentation.Slides

For slideIndex = 0 To slides.Count - 1

Dim pholders As Placeholders = slides(slideIndex).Placeholders

For i = 0 To pholders.Count - 1

Dim th As TextHolder

If TypeOf pholders(i) Is TextHolder Then

th = CType(pholders(i), TextHolder)

Else

th = Nothing

End If

If Not th Is Nothing Then

If th.Text = "TH1" Then

If groupText <> "" Then

th.Paragraphs(0).Portions(0).Text = aText

Else

th.Paragraphs(0).Portions(0).Text = bText

End If

End If

If th.Text = "TH2" Then

th.Paragraphs(0).Portions(0).Text = cText

End If

End If

Next

Dim Shapes As Shapes = slides(slideIndex).Shapes

For i = 0 To Shapes.Count - 1

Dim tf As TextFrame

If TypeOf Shapes(i) Is TextFrame Then

tf = CType(Shapes(i), TextFrame)

Else

tf = Nothing

End If

If Not tf Is Nothing Then

If tf.Text = "TH1" Then

If groupText <> "" Then

tf.Paragraphs(0).Portions(0).Text = groupText

Else

tf.Paragraphs(0).Portions(0).Text = questionText

End If

End If

If tf.Text = "TH2" Then

tf.Paragraphs(0).Portions(0).Text = HttpContext.Current.Session("QuestionnaireName")

End If

End If

Next

Next

Is there any documentation on the objects and their PPT equals and how these should be used with simple examples?

r. BA


#2

Please check Programmer’s Guide in the Wiki
http://www.aspose.com/Wiki/Default.aspx/Aspose.Slides/

Everything is right with TextHolders but Shapes collection
doesn’t contain TextFrame objects.
You should find Rectangle (or any other shape type) and
check TextFrame property. If property is not null then
shape has some text.


#3

Isn’t that what I do? Please note that I have two blocks of code looping through objects


#4

I get access denied when trying to open the link you gave me…


#5

Open “Wiki” in the menu at the top of this page and then select “Aspose.Slides”.

As I wrote the first your loop is ok but the second should be:

Dim Shapes As Shapes = slides(slideIndex).Shapes
For i = 0 To Shapes.Count - 1
Dim tf As TextFrame
If Not Shapes(i).TextFrame Is Nothing Then
tf = Shapes(i).TextFrame
Else
tf = Nothing
End If


Next


#6

Got that thanks

How do I set the Title and the footer text defined in the slide base style?