This looks very promising but I have a few questions -
1. I want to save individual slides out as JPG files at a specific width and height. SavetoSVG appears to be just for vectors. How do I save as jpeg?
2. I want to grab the title, body, etc. text in each slide - looping through the collection. There are very few examples and after digging through the documentation for a long time have come up empty. Is there a simple sample that goes through all the shapes in a given slide? Thanks.
Almost there - I can output the graphics, but having difficulty with text
I have an extremely simple 3 slide test file that has a title and single bullet + notes for the first two slide, the third slide has no notes.
I can easily obtain notes but cannot obtain text at all -here is my code fragment - the object has already been created and a PPT file opened successfully
For each shape in Pres.Slides(i).Shapes If not shape.textframe is Nothing then Dim tf as TextFrame Dim nt as Notes Dim para as Paragraph
tf = shape.TextFrame nt = Pres.Slides(i).Notes
if tf.IsTextHolder then ’ try to get text here For each para in tf.Paragraphs SlideText = Slidetext & para.Text Next end if End If
Important part was lost in the VB version of this demo. You should check also Placeholders collection for each slide.
Dim j As Integer For j = 0 To slide.Placeholders.Count - 1 Dim holder As Placeholder = slide.Placeholders(j) If TypeOf holder Is TextHolder Then For Each Paragraph para in(CType(holder, TextHolder)).Paragraphs SlideText = SlideText & para.Text Next End If Next
I just tried your code frag and there must be something missing - even though I have already created the slide object and assigned it to a slide in the presentation,
The second line in your sample - slide.Placeholders.Count dies with an Object Reference Not set to an instance of the object error. I checked and I dont think it is a scope issue as the slide object is set within the same loop, higher up sequentially in the code. Any ideas on how to fix this?
There are 2 ways to create PDF files. One is create images and insert it to PDF file (PPT2PDF demo). Another way is use Presentation.SaveToPdf method. You don’t need Aspose.Pdf in this case.
This does not work and I have posted several times on this board and have been ignored.
Our code is identical to what you have listed above. What is happening is that we are looping through a 58 slide presentation and when we get to the line
if TypeOfholder is TextHolder then
never evaluates to true even through there are plenty of bullet points and type in the presentation. PLEASE HELP!
I tested code before posting in the forum. It works for me and probably for hundreds of customers because you are the first who tell about such problems. If you need help please provide your real code and example of presentation where this code doesn’t work.
Also you can try to use iterator:
Dim iterator As IDictionaryEnumerator = slide.Placeholders.GetEnumerator() While iterator.MoveNext() If TypeOf iterator.Value Is TextHolder Then Dim th As TextHolder = CType(iterator.Value, TextHolder) Dim para As Paragraph For Each para In th.Paragraphs System.Console.WriteLine(para.Text) Next End If End While