I am having problems reading the text of a TextFrame Shape. I am able to read the AlternateText property and so I am sure this is the right Shape. Everything else is working with my code except where I access frame.Text
FileStream fis = new FileStream(Server.MapPath(“test.ppt”), FileMode.Open, FileAccess.Read);
Presentation storyboard = new Presentation(fis);
fis.Close();
Slides slides = storyboard.Slides;
//the first shape in test.ppt TextFrame frame = slides[0].Shapes[0] as TextFrame;
root.ChildNodes[0].InnerText = frame.Text;
frame.AlternateText returns the alternate text that I set, but frame.Text is not returning anything. In test.ppt the my first shape contains some sample text.
I originally used your code exactly, but when I had problems I wanted to isolate where the problem was and so I changed things slightly.
When I used the following code…
TextFrame frame = slides[0].Shapes[0] as TextFrame; if (frame != null) root.ChildNodes[0].InnerText = frame.AlternateText;
frame.AlternateText was returning the alt text that I had set in my shape in my Powerpoint presentation file. This led me to conclude that slides[0].Shapes[0] was the correct text frame, but that frame.Text was not returning what I was expecting it to return.
Does this make sense?
Basically, here is what I am trying to achieve…
1. I want to create a text area in Powerpoint and set its alt text (“title” for example)
2. Then I want to populate my text area with sample text (“My Sample Title”)
3. Then I want to use the Aspose API to open my Powerpoint and extract the text "My Sample Title"
In the example above I am able to read frame.AlternateText as “title” but I am not able to read frame.Text as “My Sample Title”. Instead frame.Text is not returning anything.