We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error Opening presentation following upgrade of Aspose.slides for .net

Using Office 2013 when I open a presentation saved as pptx I now get the message "PowerPoint found a problem with content in . PowerPoint can attempt to repair the presentation."


Code as below :
private byte[] PowerPointHandler(byte[] rawDoc, string docExtension)
{
byte[] docBytes = null;
if (Properties.Settings.Default.UseDocumentProperties)
{
if (string.Equals(docExtension, “.pptx”))
{
MemoryStream pwrPntStream = new MemoryStream(rawDoc);
pwrPntStream.Position = 0;
               QWS.<span style="color:#2b91af;">Content</span> qContent = GetContentDetails();
               <span style="color:#2b91af;">Presentation</span> pres = <span style="color:blue;">new</span> <span style="color:#2b91af;">Presentation</span>(pwrPntStream);
               <span style="color:#2b91af;">IDocumentProperties</span> docProps = pres.DocumentProperties;
               docProps.Author = Properties.<span style="color:#2b91af;">Settings</span>.Default.DefaultDocOwner;
               docProps.Category = qContent.LibraryFolderTitle;
               docProps.Comments = qContent.AlertText;

               docProps[<span style="color:#a31515;">"Category Name"</span>] = qContent.LibraryFolderTitle;
               <span style="color:blue;">if</span> (qContent.DateToExpire.HasValue)
                   docProps[<span style="color:#a31515;">"Expires on"</span>] = (<span style="color:#2b91af;">DateTime</span>)(qContent.DateToExpire);
               docProps[<span style="color:#a31515;">"Content ID"</span>] = _docId.ToString();
               docProps.RevisionNumber = qContent.Revision;
               docProps.Comments = qContent.Comments;
               docProps.Subject = qContent.Title;
               <span style="color:green;">//write the document back </span>
               <span style="color:#2b91af;">MemoryStream</span> outstream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>();
               pres.Save(outstream, Aspose.Slides.Export.<span style="color:#2b91af;">SaveFormat</span>.Pptx);
               docBytes = outstream.ToArray();
           }
           <span style="color:blue;">else</span>
           {
               <span style="color:#2b91af;">MemoryStream</span> ms = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>(rawDoc);
               ms.Position = 0;
               QWS.<span style="color:#2b91af;">Content</span> qcontent = GetContentDetails();
               <span style="color:#2b91af;">Presentation</span> pres = <span style="color:blue;">new</span> <span style="color:#2b91af;">Presentation</span>(ms);
               pres.DocumentProperties.Author = Properties.<span style="color:#2b91af;">Settings</span>.Default.DefaultDocOwner;
               pres.DocumentProperties.Category = qcontent.LibraryFolderTitle;
               pres.DocumentProperties.Comments = qcontent.AlertText;
               pres.DocumentProperties[<span style="color:#a31515;">"Category Name"</span>] = qcontent.LibraryFolderTitle;
               <span style="color:blue;">if</span> (qcontent.DateToExpire.HasValue)
                   pres.DocumentProperties[<span style="color:#a31515;">"Expires on"</span>] = (<span style="color:#2b91af;">DateTime</span>)qcontent.DateToExpire;
               pres.DocumentProperties[<span style="color:#a31515;">"Content ID"</span>] = _docId.ToString();
               pres.DocumentProperties.RevisionNumber = qcontent.Revision;
               pres.DocumentProperties.Comments = qcontent.Comments;
               pres.DocumentProperties.Subject = qcontent.Title;
               <span style="color:#2b91af;">MemoryStream</span> oStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>();
               pres.Save(oStream, Aspose.Slides.Export.<span style="color:#2b91af;">SaveFormat</span>.Ppt);
               docBytes = oStream.ToArray();
           }
       }
       <span style="color:blue;">return</span> docBytes;
   }</pre></div>

Hi Derek,


Thanks for inquiring Aspose.Slides.

I have observed the sample code shared by you along with issue specified. First of all, I suggest you to please try using Aspose.Slides for .NET 14.6.0 on your end. if there is still an issue then please share the sample source and generated presentations with us so that I may reproduce the issue on my end to help you further in this regard.

Many Thanks,

I am using version 14.6.

I have attached two files. The working version is the file that sits on the server and the non-working version is the file that is saved by Aspose.slides after adding document properties.

Hi Derek,

I have worked with the sample code shared by you and like to share that you need to add the date in the form of String rather than DateTime object. Please try using the following sample code for setting the Date in your application.

docProps[“Expires on”] = ((DateTime)(qContent.DateToExpire)).ToString();

I hope this will work. Please share, if I may help you further in this regard.

Many Thanks,

Yes, that was the problem. Many thanks