Protecting Excel data sheet within Powerpoint (read only)

Hi

I’m trying to protect a sheet within a slide. So the user can open PowerPoint view the chart, edit the colors etc. but when they click on edit data and try and changes the figures they get a standard excel message (The cell or chart your’e trying to change is on a protected sheet).

Is this possible. I’ve attached the code im using from a demo on Aspose. (CreateSlide.txt) The resulting chart (AsposeChart2.pptx) and the powerpoint file i would like to be able to create (example locked ppt)

Thanks

Hi Matt,


Thank you for considering Aspose.Slides.

I have observed the chart shared by you and like to share that Aspose.Slides provides the ShapeLock property to lock any shape on the slide. However the data of a chart resides in a worksheet whose properties could be accessed by using either Microsoft Excel or progmatically by using Aspose.Cells.

Following sample code could be used to lock the shape.

chart.ShapeLock.SelectLocked = true;

For more information about worksheet protection, you may please consult Aspose.Cells support team in Aspose.Cells forum.

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi Matt,

I have investigated the requirement further on my end and like to share that you will be using the following sample code to read chart workbook and then write the modified chart workbook. I have set the protection for chart workbook and saved the workbook. However, when I write the modified chart workbook using Aspose.Slides for the desired chart, I get NullReference Exception. An issue with ID SLIDESNET-36365 has been created in our issue tracking system to further investigate and resolve the issue. You will be able to use the following sample code once the issue will be fixed. For the time being, you can open the chart data in edit mode in Ms Excel and set its protection level.

public static void ProtectChartWorkbook()
{
String path = @“D:\Aspose Data”;

Presentation pres = new Presentation(path+“Test.pptx”);
IChart chart = (IChart)pres.Slides[0].Shapes[0];

MemoryStream ReadStream = chart.ChartData.ReadWorkbookStream();
ReadStream.Position = 0;

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(ReadStream);


//Accessing the first worksheet in the Excel file
Aspose.Cells.Worksheet worksheet = wb.Worksheets[0];

//Protecting the worksheet with a password
worksheet.Protect(Aspose.Cells.ProtectionType.All, “123”, null);


//Password protect the file.
wb.Settings.Password = “1234”;


MemoryStream mem = new MemoryStream();

wb.Save(path+“TestChart.xlsx”, Aspose.Cells.SaveFormat.Xlsx);

wb.Save(mem, Aspose.Cells.SaveFormat.Xlsx);


mem.Position = 0;
chart.ChartData.WriteWorkbookStream(mem);

pres.Save(path+“ModifiedChart.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

}

We are sorry for your inconvenience,

Ok, some good news then. Least its possible.

Thanks for spending the extra time on this.

Hi Mudassir


Can you see if there’s been any progress on this issue (SLIDESNET-36365) in your tracking software.

Many thanks
Matt

Hi Matt,

I have verified from our issue tracking system and like to share that our development team has investigated the requirement on its end and like to share that Aspose.Slides does not support encrypted excel package in the application and for that reason you are unable to load such presentation with encrypted excel package. I suggest you to please try using the excel file without password protection for the chart data.

Many Thanks,