Exception when setting notes text

Hi,

we use Aspose Slides to edit the notes text of slides. This is our code:

            var pres = new Presentation(@"S:\tmp4\T00I309200R9L63_.pptx");

            foreach (var notes in pres.Slides.Select(slide => slide.NotesSlideManager.NotesSlide ?? slide.NotesSlideManager.AddNotesSlide()))
            {
                notes.NotesTextFrame.Text = "";
            }

However there are some slides for which the NotesTextFrame property is null. I attached you an example. According to the docs, the property is read only so we get an exception here. What is the proper way to handle this issue?

I also noticed if I open the the file with powerpoint itself and just click into the notes field (without typing) and saving it again, the NotesTextFrame isn´t null any more. For this behaviour I added a gif and the working slide into the archive. As doing this manual workaround for each slide in a real presentation is massive work I would appreciate if you may analyze this issue or can give me a solution how we should handle the case where the NOtesTextFrame is null.

Kind Regards,
Daniel

example.zip (5.5 MB)

@Serraniel,

I have observed the issue shared by you and an issue with ID SLIDESNET-40963 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Hi @Adnan.Ahmad ,

The issue status has been changed to resolve and is listed inside the changelog of Aspose.Slides 19.4, however, I still get a System.NullReferenceException with the above code in line notes.NotesTextFrame.Text = ""; with the T00I309200R9L63_original.pptx from my original zip archive.

Do I have to change something in the code to get it working with the new Aspose.Slides version?

Kind Regards,
Daniel

@Serraniel,

I have observed your comments. Can you please check attachment. In screenshot image you will there is no NotesTextFrame on the Notes slide in “T00I309200R9L63_original.pptx”. Please, use Slide.NotesSlideManager.AddNotesSlide() method if you need to create absent Notes slide or get Notes slide with NotesTextFrame.

var pres = new Presentation(path + “T00I309200R9L63_original.pptx”);
ISlide slide = pres.Slides[0];
INotesSlide notes = slide.NotesSlideManager.AddNotesSlide(); // returns NotesSlide with added NotesTextFrame if there isn’t
notes.NotesTextFrame.Text = “ABCD”;

Thanks for your help, we got it working!

@Serraniel,

You are very welcome.