Hi
Hi Matt,
chart.ShapeLock.SelectLocked = true;
For more information about worksheet protection, you may please consult Aspose.Cells support team in Aspose.Cells forum.
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.
Hi Mudassir
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,