Powerpoint crashes when try to save ppt-file

Hi,

i created some test ppt-files, normally they re 100% fine. But sometimes I m not able to store the resulting files in Powerpoint2003.
When I navigate through the slides and close PP2003, it crashes.
I receive the errormessage: "Microsoft Office Powerpoint has encountered a problem and needs to close. We are sorry for the inconvenience."

The crash occurs when i navigate through the slides (and close ppt after that), when i try to change text in a slide or when i try to save ppt-file.

Can you have a look at this presentation. Do I use elements Aspose.Powerpoint does not support?

Carsten

Dear Carsten,

I will check it, but I need also source ppt file and information how you changed it.
If you can send also sources it would be great.

Hi Alexey,

here is the complete code i use to create powerpoint-files. Its a little bit much and most comments are in german , but i hope this helps to recognize the problem.


I fill an empty template with my application. The content of output file comes from a xmlfile "xmldoc.xml". The structure of this file has a bad style (hierarchy), but i have no rights to change it (makes my code partwise not easy to understand).
Its split into blocks which contains slides. I use textboxes (bullettext), pictures and tables.

Here are 2 example presentations, one which is working and one which causes the crash. To test these presentations, copy "xmldoc.xml" and "template.ppt" into debug folder. Outputfile is "CopyOfpres.ppt" in debug folder.

I dont have an explanation for the crashes, they occurs sometimes.

If you delete one of the following blocks from xmlfile, the presentation still works:

ClientSituation (contains a simple textbox)
Overview (2 slides, one with a textbox and one with a table)
WorstCase (2 slides, one with a picture and one with a textbox)
BreakEven (2 slides, one with a picture and one with a textbox)
BestCase (2 slides, one with a picture and one with a textbox)

There are a lot of other combinations in which the output file is fine, but in some cases it crashes.
Its very strange for me.


I know this is much code for the problem, but i m not really able to encapsulate it into a smaller component which show the crashes.
I use Aspose.Powerpoint Version 2.0.1.0


Thanks,

Carsten

Dear Carsten,

Your code:
// create an empty presentation
int size = m_pres.Slides.Count-1;
for (int i=size; i>0; i–)
m_pres.Slides.RemoveAt(i);

You shouldn’t delete all non-master slides from a presentation.
At least one slide must exist and can be deleted at the end of changing presentation.
Also you shouldn’t delete master slides.

// create an empty presentation
int num_masters = 0;
for (int i = 0; i < m_pres.Slides.Count; i++)
if (m_pres.Slides[ i ].SlidePosition == 0)
num_masters++;
int size = m_pres.Slides.Count - (1 + num_masters);
for (int i=size; i>0; i–)
if (m_pres.Slides[ i ].SlidePosition != 0)
m_pres.Slides.RemoveAt(i);

Other bugs in your code are CloneSlide calls:
Slide newSlide = m_pres.CloneSlide(templateSlide, position, m_pres, m_sList);

Method CloneSlide must be used from source presentation:
Slide newSlide = m_templatePres.CloneSlide(templateSlide, position, m_pres, m_sList);
or
Slide newSlide = templateSlide.Parent.CloneSlide(templateSlide, position, m_pres, m_sList);

Thanks a lot, that fixed my problem.

Next month we will finish evaluation. Now I m sure that we choose Aspose.Powerpoint for our projects.

Great support!


Carsten

Hi,

I have the task of continuing Carstens work at our company. Right now we are having problems upon opening the generated ppt files. The presentation themselves seem fine but we still get the following message when we open the file:

"PowerPoint was unable to display some of the text, images, or objects on slides in the file, "", because they have become corrupted. Affected slides have been replaced by blank slides in the presentation and it is not possible to recover the lost information. To ensure that the file can be opened in previous versions of PowerPoint, use the Save As command (File menu) and save the file with either the same or a new name."

I have isolated the problem to the following block of code in the function SavePresentation():

for (int i=num_templateSlides+1; i>0; i--)
if (m_pres.SlidesIdea [I].SlidePosition != 0)
m_pres.Slides.RemoveAt(i);

If I skip this block of code, the generated ppt can be opened without any problem. But then unwanted slides from the template.ppt remain in the resulting ppt, which is not desirable.

I don't understand why removing any of the slides from the template slide causes such a an error message when opening the resulting ppt. Please help.

Regards,

Duane

PS: attaching source template, result template and code

Dear Duane,



You didn’t attach files.

If you have problems with attach please send it by email

tyumen at aspose.com

2nd try @ attaching