Hi,
I was using aspose.slides to convert ppt to pdf. The date&time is updating automatically whenever i am converting to pdf as it selected as update automatically while inserting it. So i would like to turn it off. irrespective of whether it is created in header/footer or inside the content of the data. Can you help how do i do it. I was able to figure it out for word to pdf by setting “field.IsLocked = true;” but not able to figure it out how do we do the same for ppt
Below is the code i use to convert to pdf.
using (Aspose.Slides.Presentation presentation = new Aspose.Slides.Presentation(filePath))
{
foreach (ISlide slide in presentation.Slides)
{
if ((slide.Hidden))
{
slide.Hidden = false;
}
IShapeCollection sc = slide.Shapes;
int count = sc.Count;
bool fieldremoveflag = false;
for (int i = 0; i < count; i++)
{
IShape shape;
if (fieldremoveflag)
{
count = count - 1;
i = i - 1;
shape = sc[i];
fieldremoveflag = false;
}
else
{
shape = sc[i];
}
if (shape.Placeholder != null
&& !(shape is Aspose.Slides.PictureFrame)
&& !(shape is Aspose.Slides.SmartArt.SmartArt))
{
IPlaceholder pc = ((AutoShape)shape).Placeholder;
if (pc != null && pc.Type == PlaceholderType.DateAndTime)
{
// sc.Remove(shape);
fieldremoveflag = true;
}
else
{
if (((AutoShape)shape).TextFrame != null)
{
foreach (IParagraph para in ((AutoShape)shape).TextFrame.Paragraphs)
{
foreach (IPortion port in para.Portions)
{
if (port.Field != null)
{
if (port.Field.Type.InternalString.Contains("datetime"))
{
// sc.Remove(shape);
fieldremoveflag = true;
}
}
}
}
}
}
}
}
}
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.NotesCommentsLayouting.NotesPosition = NotesPositions.BottomTruncated;
pdfOptions.NotesCommentsLayouting.CommentsPosition = CommentsPositions.Right;
presentation.Save(destinationPath, Aspose.Slides.Export.SaveFormat.Pdf, pdfOptions);
return presentation.Slides.Count;
}