I am using Slides.Net 2.7.0.0 to open a powerpoint presentation, find a specific table and update text in that table. Everything worked perfectly using Visual Studio 2003, Windows XP and Office XP. Unfortunately, I have to switch all my projects to Visual Studio 2005, Windows Vista and Office 2007. After many days of headaches, I've got my project updating the text correctly. The problem now lies in saving the file after the update. When the Write function is executed it deletes the contents of the presentation. I have traced my code and determined that the Write function is definitely causing the deletion of the contents. Here are the calls I make to access the presentation and to save the changes I have made:
Dim pptDoc As Presentation = New Presentation(doc.FullName)
Lots of code that updates a portion of the presentation.
Dim pptDoc As Presentation = New Presentation(doc.FullName)
pptDoc.Write(doc.FullName)
I've attached the ppt file that I am experiencing the issues with. I have not opened the ppt file with 2007 either prior to nor after running my application. I want Aspose.Slides to be the only interaction with the file. The file starts at 988kb and after my application runs the above code, the file is 0kb.
If I insert any line of code that refers to pptDoc after the pptDoc.Write(doc.FullName) call, then I get the following exception:
System.NotSupportedException occurred Message="This operation is not supported on SortedList nested types because they require modifying the original SortedList." Source="mscorlib" StackTrace: at System.Collections.SortedList.ValueList.set_Item(Int32 index, Object value) at Aspose.Slides.Table.(Int32 , Int32 , Int32 ໜ) at Aspose.Slides.Table.ໞ(Int32 ໙, Int32 ࢌ) at Aspose.Slides.Table.ോ() at Aspose.Slides.Rectangle.ോ() at Aspose.Slides.Shape.ૠ() at Aspose.Slides.Presentation.ૠ(Boolean ) at Aspose.Slides.Presentation.Write(Stream stream) at Aspose.Slides.Presentation.Write(String file) at Glossary.Glossary.getPpt(FileSystemInfo doc) in C:\Users\Allison Landsberger\Documents\Visual Studio Projects\Glossary\Glossary\Glossary.vb:line 311
I am assuming that this exception is due to the contents of the file being deleted.
Is there support for pptx? When I tried to open a pptx I got a header error:
System.Exception occurred Message="Invalid header signature; read 1688935826934608, expected 16220472316735377360" Source="Aspose.Slides" StackTrace: at ࠴.ဃ..ctor(Stream stream) at ࠴.མ..ctor(Stream stream) at Aspose.Slides.Presentation..ctor(String file) at Glossary.Glossary.getPpt(FileSystemInfo doc) in C:\Users\Allison Landsberger\Documents\Visual Studio Projects\Glossary\Glossary\Glossary.vb:line 310
Also, my application doesn't work for ppt files that were created with 2007. That may be a problem with my code, since it looks for shapes that are textHolders and then tries to read the text in the textHolder. I get a null reference exception on the pink line below.
If pptShape.IsTextHolder Then
MessageBox.Show(pptShape.GetType.FullName)
If pptShape.GetType.FullName = "Aspose.Slides.OleObjectFrame" Then
Else
Dim txtHolder As Aspose.Slides.TextHolder = CType(pptShape.Placeholder, TextHolder)
MessageBox.Show(txtHolder.Text)
If txtHolder.Text = txtTitleOne.Text Or txtHolder.Text = txtTitleTwo.Text Then
PPTX (PP 2007 File Format) is not supported yet, but will be supported soon in future.
PP 2007 converts the placeholders into textframes, which then breaks the existing code. You can access all of your placeholders from Slide.Shapes collection now.
For more information regarding this problem, see this thread.