Free Support Forum - aspose.com

[PHP] Can't exporting an XLS Object (chart) from a shape

Hi,

I tried to reproduce this tutorial (part 2) to extract the OLE object into a XLS file:
http://www.aspose.com/documentation/java-components/aspose.slides-for-java/working-with-ole-object-frames.html thanks to PHP wrapper.

Bug report
There is a php error when calling “findshape” which seems to be an Aspose bug:
Notice: Undefined variable: slide in C:\workspace_nb\Aspose\apps\kerastase\modules\accueil\actions\AsposeSlides.php on line 4315

function findShape($string) {
$shape = $slide->findShape($string);
$cf = new ClassFactorySlides();
$shape_php = $cf->CreateShapePhp($shape);
return $shape_php;
}

I replaced $slide by $this->m_slide and it’s OK.

My issue

The example works for the given input PPT and chart, but if I replace it with any of my own chart (bar chart, radar, etc… see attachment), it doesn’t work: no error when I try to open the generated excel but Excel refuse to open it.

Any idea?

Damien

Hi Damien,

Thanks for your interest in Aspose.Slides.

Please share your .php file for investigation purpose. Which version of Aspose.Slides for Java you are using?

Here is my code, which is working for the ppt/chart in the tutorial. I’ve added a namespace “Slides”, because of the use of both AsposeSlides.php and AsposeExcel.php.

You have the code, the problematic ppt in my previous post, hope you’ll understand the issue.


$pres = Slides\ClassFactory::NewPresentation(“C:/chart.ppt”);
$slide = $pres->getSlideByPosition(1);
$oof = $slide->findShape(“chart”);
if ($oof != null) {
$fstr = new Java(“java.io.FileOutputStream”, “C:/excel_generated.xls”);
$buf = $oof->getObjectData();
$fstr->write($buf, 0, strlen($buf));
$fstr->flush();
$fstr->close();
echo “Excel OLE Object written as excel_generated.xls file”;
}
$pres->write(“C:/workspace_nb/Aspose/web/pres_generated.ppt”);

Hi Damien,

Thanks for sharing the information. Please let me know which version of Aspose.Slides for Java are
you using?

Sorry! The version is Aspose-slides-2.5.0-java

Hi Damien,

I have tested the issue shared by you and I am able to reproduce the same problem. An issue with ID SLIDESJAVA-28325 already
exists in our issue tracking system. This thread has also been linked
with the same issue, so that you may be automatically notified, once
the issue is resolved


We apologize for your inconvenience.