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

Free Support Forum - aspose.com

Making the Powerpoint file as Non-editable(read only)

Hi,

As, I want to know whether it is possible to make the powerpoint file as non-editable(read only) using aspose.slides.

Regards

Raghu Veer Gupta.

Dear Raghu,

The only way to make the ppt read-only is to write it with .pps extension. However, you cannot password protect it with Aspose.Slides.

Same question except for pptx (powerpoint 2007) version. As of July 2010, is there a way I can save or stream back a “read-only” for PresentationEx? This would be a great feature. Many people would like to build a software that creates a presentation/report without allowing the end user able to modify the pptx file.

Hello Dear,

I regret to inform you that the feature of saving presentation file as read only is currently unavailable in Aspose.Slides for .NET. However, the feature of locking different shapes is available that can be used to achieve the goal of making the presentation read only. You need to traverse each shape on each slide and apply different desired locks on them. Locks prevents the editing, movement, selection or resizing of the shapes. Please find the sample code snippet below, which can be used to serve your purpose.

public static void AddPptxSecurity()

{

//Load the presentation

Presentation slidesPresentation = new Presentation(@"D:\Aspose Data\Test.pptx");

//Loop through the master slides

for (int i = 0; i < slidesPresentation.Masters.Count; i++)

{

//Loop through the shapes on the master slide

foreach (ShapeEx masterShape in slidesPresentation.Masters[i].Shapes)

{

//Apply protection on the shape

if (masterShape is AutoShapeEx)

{

AutoShapeEx aShp = (AutoShapeEx)masterShape;

aShp.ShapeLock.SelectLocked = true;

aShp.ShapeLock.TextLocked = true;

}

else if (masterShape is GraphicalObjectEx)

{

GraphicalObjectEx grShp = (GraphicalObjectEx)masterShape;

grShp.ShapeLock.PositionLocked = true;

grShp.ShapeLock.NoSelect = true;

grShp.ShapeLock.SelectLocked = true;

}

else if (masterShape is PictureFrameEx)

{

PictureFrameEx pShp = (PictureFrameEx)masterShape;

pShp.ShapeLock.SelectLocked = true;

pShp.ShapeLock.PositionLocked = true;

}

else if (masterShape is GroupShapeEx)

{

GroupShapeEx pShp = (GroupShapeEx)masterShape;

pShp.ShapeLock.SelectLocked = true;

pShp.ShapeLock.GroupingLocked= true;

}

else if (masterShape is ConnectorEx)

{

ConnectorEx conShp = (ConnectorEx)masterShape;

conShp.ShapeLock.SelectLocked = true;

conShp.ShapeLock.NoSelect = true;

}

}

}

//Now Loop through the normal slides

foreach (SlideEx normalSlide in slidesPresentation.Slides)

{

//Loop through the shapes on the normal slide

foreach (ShapeEx normalShape in normalSlide.Shapes)

{

//Apply protection on the shape

if (normalShape is AutoShapeEx)

{

AutoShapeEx aShp = (AutoShapeEx)normalShape;

aShp.ShapeLock.SelectLocked = true;

aShp.ShapeLock.TextLocked = true;

}

else if (normalShape is GraphicalObjectEx)

{

GraphicalObjectEx grShp = (GraphicalObjectEx)normalShape;

grShp.ShapeLock.SelectLocked = true;

grShp.ShapeLock.PositionLocked = true;

}

else if (normalShape is PictureFrameEx)

{

PictureFrameEx pShp = (PictureFrameEx)normalShape;

pShp.ShapeLock.SelectLocked = true;

pShp.ShapeLock.PositionLocked = true;

}

else if (normalShape is GroupShapeEx)

{

GroupShapeEx pShp = (GroupShapeEx)normalShape;

pShp.ShapeLock.SelectLocked = true;

pShp.ShapeLock.GroupingLocked= true;

}

else if (normalShape is ConnectorEx)

{

ConnectorEx conShp = (ConnectorEx)normalShape;

conShp.ShapeLock.SelectLocked = true;

conShp.ShapeLock.NoSelect= true;

}

}

}

//Write the presentation to the disk

slidesPresentation.Write("presLocked.pptx");

}

Thanks and Regards,