When i try to save presentation i get the error below.
- Code: Select all
Exception Message:Object reference not set to an instance of an object., StackTrace: at spr.ᜂ()
at spr.ᜀ(sprᢝ A_0)
at Spire.Presentation.Collections.ShapeList.ᜀ(sprᢝ A_0)
at Spire.Presentation.GroupShape.PptxPrepareForSaving(sprᢝ saveContext)
at Spire.Presentation.ActiveSlide.PresentationBeforeSave(sprᢝ saveContext)
at spr.ᜀ(sprᢝ A_0)
at spr.ᜀ(sprᢝ A_0, sprᜪ A_1)
at spr.ᜀ(Stream A_0, sprᜪ A_1, spr A_2)
at spr.ᜀ(Stream A_0, spr᪩ A_1, spr᪪ A_2)
at spr.ᜀ(String A_0, spr᪩ A_1)
at Spire.Presentation.Presentation.SaveToFile(String file, FileFormat fileFormat)
at SlideBuilder.Generator.Domain.Services.SlideGenerator.GeneratePresentation(String presentationType, Byte[]& presentationFile, String& fileName, String& presentationFilePath, Int64& templateFileSizeInBytes, String& errorDescription) in /src/Microservices/Domain/SlideBuilder.Generator.Domain/Services/SlideGenerator.cs:line 292 Slide Index:0
Source Code:
- Code: Select all
//Load template presentation
Presentation templatePresentation = new Presentation();
templatePresentation.LoadFromFile("crashes-app.pptx");
//Create New Presentation
Spire.Presentation.Presentation presentation = new Spire.Presentation.Presentation();
presentation.Slides.RemoveAt(0);
//Create Temporary Blank Presentation
var blankPresentation = new Spire.Presentation.Presentation();
//Get slide from template presentation. index:1
ISlide cloneSlide = templatePresentation.Slides.ToArray().ElementAtOrDefault(1);
//Insert slide to the blank presentation
blankPresentation.Slides.Insert(0, cloneSlide);
//Get inserted slide from blank presentation
ISlide templateSlide = blankPresentation.Slides[0];
//Append templateSlide to the presentation
presentation.Slides.Append(templateSlide);
//Save and launch to view the PPTX document.
presentation.SaveToFile("new-file.pptx", Spire.Presentation.FileFormat.Pptx2010);
Template File:
I notice that the crashes-app.pptx file type is LibreOffice/6.4.7.2$Linux_X86_64 LibreOffice_project/40$Build-2 (I get the ppt file versions according to that page. https://stackoverflow.com/questions/440 ... a-ppt-file)
When i open and save as that crashed pptx file this time that pptx file works fine :attachment=0]crashes-app-fix.zip[/attachment]
crashes-app-fix.pptx file type is 16.0000 (PPT 2016)
Can you check that problem ?
Thank you.