PDA

View Full Version : Slide NotesPage in html



hawkeye01
09-12-2005, 05:36 PM
Hi,

Some of the posts on this forum really helped me to get my application up and running. I do have one more question to which I don't have the answer to yet:

I was able to get the text of the NotesPage out and into separate text files (one per slide). However, some of the notes pages had bulleted lists, special characters or formatted text.

Is there a way that these can be retained - maybe by exporting the contents of the notes page as html?

Any help would be greatly appreciated.

Thanks!

Killian
09-13-2005, 06:00 AM
Hi and welcome to VBAX :hi:
I suppose how you do this depends on want you want as an end product, text file(s), an html file or something else.
You can check each paragraph to see if it's bulletted and output something to replicate that in whatever format you want to use.
Here I've just used the native VBA Print to add the text from each shape on each notes page to a text file, so I build the string by paragraph and add a "- " if it's bullettedDim sld As Slide
Dim shp As Shape
Dim p As Long
Dim strOutputText As String

'open text file
Open gFILE_PATH For Output As 1

For Each sld In ActivePresentation.Slides 'loop thru each slide
For Each shp In sld.NotesPage.Shapes 'loop thru each shape on the slide
strOutputText = ""
If shp.HasTextFrame Then 'if it is a textbox
With shp.TextFrame.TextRange
For p = 1 To .Paragraphs.Count 'go thru each para and simulate a bullet if required
If .Paragraphs(p, 1).ParagraphFormat.Bullet Then
strOutputText = strOutputText & "- " & .Paragraphs(p, 1).Text
Else
strOutputText = strOutputText & .Paragraphs(p, 1).Text
End If
Next p
End With
End If
Print #1, strOutputText 'write the shape text to the text file
Next shp
Next sld

Close #1 'close the text file

hawkeye01
09-13-2005, 07:52 PM
Hi Killian,

Thanks a ton ....this is really interesting and helpful...
but say if the slide notes contained actual html i.e. with colors and fonts in addition to paragraphs and bulleted lists, then I guess there is no easy way (read 'one line command') to extract that? Going by the solution above, one would need to specify all the possibilities and then generate the output html accordingly - am I missing something here?

Thanks again!

Killian
09-14-2005, 02:09 AM
I don't think you're missing anything... each item, down to the level you require (paragraph, sentence, word, character) would have to be checked and tagged accordingly.
But I'm not clear on what your requirement is... I took it to be writing to a text file (which has no formatting, like bold and fonts etc, it's just text).
Testing and tagging all the formatting and writing out an html file is possible but would be relatively complex.
If you want to retain the formatting, you will need some target document that will support it. In terms of single line solutions, if you copy the text, you will be able to use PasteSpecial with one of the html formats in PowerPoint or PasteAndFormat in Word.
But what do you want to end up with?

hawkeye01
09-14-2005, 10:22 AM
Sorry, I guess I should have clarified what I'm trying to do :).. I was thinking of building a small utility that will take a specific ppt, and 'extract' all the info within i.e. each slide will be saved as a gif, and all the notes would be saved either as html files or into a database with all formatting retained. The extracted info would then be visible through a browser (slide image + notes).

I've been able to write the images and the text from the notes pages, using the examples posted within this forum. However, since the notes in the original ppt could be formatted, I would ideally like to extract it with all formatting intact. Hence, when displayed in a browser, the notes would look exactly as it did in the original ppt.

Killian
09-15-2005, 01:17 AM
To get an exact match for the notes text format manually, you will have to check the format of each word and write out the html accordingly.
Is there any reason why you don't use the export as html method? This seems to do what you want, with the notes appearing in the lower pane, although the formatting isn't great, maybe it might be easier to use the htm files if produces as a starting point (?)

hawkeye01
09-15-2005, 06:16 AM
Hey Killian,

Thanks for your prompt replies as always... I could try the export as html option - I wasn't too keen on it as it would mean more parsing and reading if I wanted to get the notes into a database table. But I'll give it a shot and see what I can do with it.

Thanks for all your help..