Hi,
I have a pptx file “Presentation1.pptx” with a single slide and a chart in it. I have tried to read the file and print the chart name and then save the pptx in another location as “AsposeChartMoodified.pptx”. I have attached the files for your reference. The issue is that when I try to open the file using Microsoft Office 2007, I get an error saying “Powerpoint found unreadable content in AsposeChartMoodified.pptx. Do you want to recover the contents of this presentation?” Once I click YES, it gets opened correctly.
Can you kindly let me know how to save the pptx without any error as the unreadable data. I have provided the code and all the files used as attachments.
public void editChart(String chartDataFileName, String PPTFileName) {
// XMLParser xmlParser = new XMLParser();
// ChartServiceDAO chartserviceDAO;
// chartserviceDAO = xmlParser.parseXML(chartDataFileName);
// ArrayList alCategoryBean = chartserviceDAO
// .getCategoryBeanList();
// Instantiate PresentationEx class that represents PPTX file
PresentationEx pres = new PresentationEx(PPTFileName);
ChartEx chart = null;
for (int i = 0; i < pres.getSlides().getCount(); i++) {
// Access slides
SlideEx sld = pres.getSlides().get_Item(i);
// Add chart with default data
for (int j = 0; j < sld.getShapes().getCount(); j++) {
ShapeEx sh = sld.getShapes().get_Item(j);
if (sh instanceof ChartEx) {
chart = (ChartEx) sh;
System.out.println("CharEx Name : "+chart.getName());
// updateChart(chart, alCategoryBean);
}
}
}
// Save presentation with chart
pres.write(“D:\kalyan\AsposeChartMoodified.pptx”);
System.out.println(“Completed … D:\kalyan\AsposeChartMoodified.pptx”);
}
Kindly reply as soon as possible.
Thanks & Regards
Gaurang.