Object reference not set to an instance of an object v5.9

Hi,

I’m getting the error ‘Object reference not set to an instance of an object’ opening a powerpoint 2003 file using aspose slides .net 5.9.0.

If I open the file using Openoffice Impress just save it again and upload to Aspose it works!

Any ideas whats wrong with the file?

Thanks

kim


Hi Kim,


I have worked with the presentation file shared by you and have been able to access the presentation and export that to PDF successfully using Aspose.Slides for .NET 2.0 5.9.0. For your kind reference, I have shared the generated PDF as well. Can you please share the complete source project highlighting the issue.

Many Thanks,

Hi Kim,

Thanks for using Aspose.Slides.


I have tried shared presentation with Aspose.Slides for .NET 5.9.0 and successfully convert it in pdf file. I have used the following code for conversion.

Presentation pres = new Presentation(@"D:\Powerpoint+2003+test+orig.ppt");
pres.Save(@"D:\Powerpoint+2003+test+orig.pdf", Aspose.Slides.Export.SaveFormat.Pdf);

If you require any further information, please feel free to contact us.

Many Thanks,

Snippet

Dim srcPres As Presentation = New Presentation(uFile)

For i As Integer = 1 To srcPres.Slides.LastSlidePosition
Dim targetPres As Presentation = New Presentation()
Dim sList As New SortedList
Dim dstSld As Slide
dstSld = srcPres.CloneSlide(srcPres.GetSlideByPosition(i), targetPres.Slides.LastSlidePosition + 1, targetPres, sList)

dstSld.AddNotes()
dstSld.Notes.Paragraphs.Clear()
Dim srcSld As Slide
srcSld = srcPres.GetSlideByPosition(i)

For Each srcPara As Paragraph In srcSld.Notes.Paragraphs
Dim dstPara As Paragraph
dstPara = New Paragraph(srcPara)
dstSld.Notes.Paragraphs.Add(dstPara)
Next

Dim emptyslide As Slide = targetPres.GetSlideByPosition(1)
targetPres.Slides.Remove(emptySlide)
targetPres.Write(Server.MapPath("") & “” & stackDir & “” & newNum.toString(“D3”) & “–” & slideshowName & “\ppt” & i.ToString(“D3”) & “.ppt”)
Dim tp As String = Server.MapPath("") & “” & stackDir & “” & newNum.toString(“D3”) & “–” & slideshowName & “\ppt” & i.ToString(“D3”) & “.ppt”
Dim tiffPres As Presentation = New Presentation(tp)

Dim imgOut As String = Server.MapPath("") & “” & stackDir & “” & newNum.toString(“D3”) & “–” & slideshowName & “\jpg” & i.ToString(“D3”)

Dim MS = New MemoryStream()
tiffPres.Save(MS,Aspose.Slides.Export.SaveFormat.Tiff)
Dim img As System.Drawing.Image = system.Drawing.Image.FromStream(MS)
img.Save(imgOut & “.jpg”, System.Drawing.Imaging.ImageFormat.Jpeg)
MS.Dispose()

Next



FYI

The problem was that if there are no slide notes in the ppt it fails. So…

If Not srcSld.Notes Is Nothing Then

will fix it.

Opening in Openoffice and saving fixes it by adding a notes field to the ppt.

Kim