Please provide the sample code to extract speaker notes from ppt and pptx files.
Hi Ponraj,
I have observed your requirements and please use the following source code to serve the purpose. Please share, if I may help you further in this regard.
PresentationEx pres = new PresentationEx("D://ppt//notext.pptx");
//Access the first slide
SlideEx sld = pres.Slides[0];
//Creating Slide note instance
NotesSlideEx note = sld.NotesSlide;
//Casting to autoshape
AutoShapeEx shp1 = (AutoShapeEx)note.Shapes[1];
//Accessing autoshape’s text frame
TextFrameEx txt1 = shp1.TextFrame;
//Extracting Slide notes
MessageBox(txt1.Text);
//Updating Slide notes
txt1.Text = "Text has Changed";
pres.Write("D://ppt//notext.pptx");
Many Thanks,
Thanks.
How to do for PPT files?
PPTX: why we want hardcode as 1 in the below line:
AutoShapeEx shp1 = (AutoShapeEx)note.Shapes[1];
Also from the above sample code I'm not able to retrive the spekaer notes. I have tried with the below code:
SlideEx slide;
for (int slidecnt = 1; slidecnt < presentation.Slides.Count; slidecnt++)
{
slide = presentation.Slides[slidecnt];
NotesSlideEx notes = slide.NotesSlide;
if (notes != null)
{
ShapeExCollection shapes = notes.Shapes;
foreach (AutoShapeEx shape in shapes)
{
//Accessing autoshape's text frame
TextFrameEx text = shape.TextFrame;
if (text != null && text.Text != string.Empty)
return true;
}
}
}
PPTX: Even if the speaker notes are not there,it is trying to read junk text <#> for the above sample code.
Hi Ponraj,
public static void ReadPPTNotes(){Presentation pres = new Presentation(“D://Aspose Data//notext.ppt”);//Access the first slideSlide sld = pres.Slides[0];//Creating Slide note instanceNotes note = sld.Notes;ShapeCollection shapes = note.Shapes;int s = shapes.Count;foreach (Aspose.Slides.Shape shape in shapes){if (shape.TextFrame != null){//Accessing autoshape’s text frameTextFrame text = shape.TextFrame;if (text != null && text.Text != string.Empty){//Extracting Slide notesConsole.WriteLine(text.Text);}}}}
Thanks for the updates.
What is the difference between AutoShape and Shape. I have to use which one to get the actual speaker notes?
Hi,
Thanks for the updates.
Currently I'm using 5.7.0.0 version of Aspose.Slides.dll. Can you please provide me the link to download the latest version of slides dll.
Thanks,
Ponraj.M
Hi Ponraj. M,
Hi,
I'm trying to retrieve the notes text as well as notes format from the source PPTX slide and trying to add it in new slide. Using Aspose.Slides 6.8
I could able to get the notes and paragraph formats like indent. I have applied the fontBold,fontItalic,FontUnderline. .Though it is returning the value as False.
Please find the attached code and help me to resolve the issue.
Thanks,
Ponraj.M
Hi Ponraj.M,
Hi,
Even I said that I could able to get the indent properly. I have avided copyparagraph becuase the code will be too lengthy :). But I am unable to get the properties like font bold,italic,underline,strikethrough etc.I think using 7.4.0 will not resolve this issue as this is the basic settings which should work. I think I misssed something.
Did you able to reproduce this issue. Kindly help me to resolve the same.
Thanks,
Ponraj.M
Hi Ponraj.M,