Problems reading Frame.Text

Hi,

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.

Can you tell me what I am doing wrong? Thanks.

My code was:
TextFrame frame = slides[0].Shapes[0] as TextFrame;
if (frame != null)
root.ChildNodes[0].InnerText = frame.Text;

Why you think Shapes[0] is your text frame? I don’t see any AltText checking in code.
Where text was written? In TextHolder or TextFrame?

Also please check:
https://forum.aspose.com/t/relating-placeholders-with-shapes/110950

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.

Thanks.

As I wrote here:
https://forum.aspose.com/t/relating-placeholders-with-shapes/110950
Each TextHolder has 2 parts and Shape.Text is always empty.

So if you write text in placeholder you have to use Slide.Placeholders instead of Slide.Shapes.