Last active
March 9, 2021 11:17
-
-
Save aspose-com-gists/fa06076425f4fd9b9ed20591f404b529 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Instatiate Presentation class that represents a PPTX file | |
Presentation pptxPresentation = new Presentation("demo.pptx"); | |
//Get an Array of ITextFrame objects from all slides in the PPTX | |
ITextFrame[] textFramesPPTX = Aspose.Slides.Util.SlideUtil.GetAllTextFrames(pptxPresentation, true); | |
//Loop through the Array of TextFrames | |
for (int i = 0; i < textFramesPPTX.Length; i++) | |
{ | |
//Loop through paragraphs in current ITextFrame | |
foreach (IParagraph para in textFramesPPTX[i].Paragraphs) | |
{ | |
//Loop through portions in the current IParagraph | |
foreach (IPortion port in para.Portions) | |
{ | |
//Display text in the current portion | |
Console.WriteLine(port.Text); | |
//Display font height of the text | |
Console.WriteLine(port.PortionFormat.FontHeight); | |
//Display font name of the text | |
if (port.PortionFormat.LatinFont != null) | |
Console.WriteLine(port.PortionFormat.LatinFont.FontName); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Instatiate PresentationEx class that represents a PPTX file | |
Presentation pptxPresentation = new Presentation("demo.pptx"); | |
//Get an Array of TextFrameEx objects from the first slide | |
ITextFrame[] textFramesSlideOne = SlideUtil.GetAllTextBoxes(pptxPresentation.Slides[0]); | |
//Loop through the Array of TextFrames | |
for (int i = 0; i < textFramesSlideOne.Length; i++) | |
{ | |
//Loop through paragraphs in current TextFrame | |
foreach (Paragraph para in textFramesSlideOne[i].Paragraphs) | |
{ | |
//Loop through portions in the current Paragraph | |
foreach (Portion port in para.Portions) | |
{ | |
//Display text in the current portion | |
Console.WriteLine(port.Text); | |
//Display font height of the text | |
Console.WriteLine(port.PortionFormat.FontHeight); | |
//Display font name of the text | |
Console.WriteLine(port.PortionFormat.LatinFont.FontName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment