How to get all text from slide and word count of slide

hi i m evalutor of the slide component please any one tell me that how to get all text and word count from slide of ppt document<font face="Times New Roman"> i m attaching ppt doucment which contain 27 words please tell me code for that </font><br>

Dear akshar,

Thanks for considering Aspose.Slides.

Please check this code, I have written for you. It is fully commented and self-explanatory. Feel free to ask if you have any further question.

The output of this code is

Total Number of Words : 27

For more information regarding programming with Aspose.Slides, please see Aspose.Slides Wiki.

http://www.aspose.com/Wiki/Default.aspx/Aspose.Slides/

I have also attached the code as a text file.

********************************************************************

void CountOfTextOnSlide()

{

string dirPath=@"D:\source ppts\17-10-2007\";

//Create presentation object from existing ppt

Presentation srcPres = new Presentation(dirPath + "25+words.ppt");

//Get the first slide

Slide srcSld=srcPres.GetSlideByPosition(1);

//Iterate through all shapes, if it has textframe , then count number of words inside it

int totalWords=0;

foreach (Shape shp in srcSld.Shapes)

{

if (shp.Placeholder != null)

{

//if placeholder is a type of textholder, then get its text

if (shp.Placeholder is TextHolder)

{

//convert the placeholder into textholder

TextHolder thld = shp.Placeholder as TextHolder;

//Change the three types of characters into the spaces

string thldText = thld.Text.Replace("\n", " ").Replace("\r", " ").Replace("\v", " ");

//split the text on the basis of spaces

char[] splitParam = new char[1] { ' ' };

int wordsInThisTextHolder = thldText.Split(splitParam, StringSplitOptions.RemoveEmptyEntries).Length;

//add into the total words

totalWords += wordsInThisTextHolder;

//continue, skip the next code and move to next iteration

continue;

}//inner-if

}//if

if (shp.TextFrame != null)

{

//repeat the above, but this time with textframe

//Change the three types of characters into the spaces

string tfText = shp.TextFrame.Text.Replace("\n", " ").Replace("\r", " ").Replace("\v", " ");

//split the text on the basis of spaces

char[] splitParam = new char[1] { ' ' };

int wordsInThisTextFrame = tfText.Split(splitParam, StringSplitOptions.RemoveEmptyEntries).Length;

//add into the total words

totalWords += wordsInThisTextFrame;

}//if

}//foreach

//Print total number of words

Console.WriteLine("Total Number of Words : " + totalWords);

}

This documentation appears to be obsolete. I am trying extract all text from all slides but some classes referred to above appear to no longer exist in Aspose.Slides 14.4.0


For example:
“TextHolder” does not appear anywhere in the Aspose.Slides documentation provided with the current 14.4.0 installer.

How would this be done using the most current version of Aspose?

Thank you.

Hi Jeff,

Please use the following documentation link with details and sample code regarding how to extract text from a presentation using the latest version of Aspose.Slides for .NET.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,