phpoffice / phppresentation Goto Github PK
View Code? Open in Web Editor NEWA pure PHP library for reading and writing presentations documents
Home Page: https://phpoffice.github.io/PHPPresentation
License: Other
A pure PHP library for reading and writing presentations documents
Home Page: https://phpoffice.github.io/PHPPresentation
License: Other
To Do List for having PHPPowerPoints equals to PHPWord Quality :
It seems that PowerPoint
is a registered trademark of Microsoft.
Hello,
it is possible to set an hyperlink in table cell?
It is very important for other project.
I have solved it by adding an text-shape, but it is no good solution.
http://stackoverflow.com/questions/26846836/phppowerpoint-set-hyperlink-in-table-cell
Thanks,
Christoph
Hi,
Users want to format text with an editor like "tinyMCE" since web interface.
It's possible to set formatted text on slides without set property by property ? Maybe with RTF, HTML or other format ?
If not, would there be a solution that I can implement ? (with eventually a pull-request after)
Thanks.
On locales with a decimal mark different from the dot, the ODP writer will produce invalid documents, because page dimensions in styles.xml will contain invalid characters.
E.g., on a German (de_DE) locale, where the decimal mark is the comma, the fo:page-width attribute in style:page-layout-properties will be "25,4cm" instead of "25.4cm." The result is a broken file.
A temporary workaround is to manually set the locale to something like en_US before writing the file.
Duplicate PHPOffice/PHPExcel pages and adapt them for PHPPowerPoint
How about creating develop
branch for PHPPowerPoint, PHPVisio, and PHPProject?
Some strange Problems over here. When opening a ppt with
$pptreader = PhpOffice\PhpPowerpoint\IOFactory::createReader('PowerPoint97');
it tells me "Unknown File Format". So i have opened the File in LibreOffice and saved it as PowerPoint97 because saving in Office makes no difference. After that this Exception shows up:
Feature not implemented (l.1131 : 102)
so, what is the meaning of these numbers? ;)
Is it possible to add notes/comments for each slide ?
You said it can read, but I couldn't find any code that can read powerpoint file, could you please show me a small example or source files where I can find it?
when a richTextShape shrink to adapte his height to his content text, we can't get the "real" height of the shape with getHeight(), only the height witch have been defined by setHeight()
so it make impossible to set y offset of an other element below the richTextShape depending on his (dynamic) text size.
may be there is an other way to do that, but didn't find... ?
(sorry my bad english)
Hi,
I don't succeed in modify the inset top and bottom of a row in a table.
Is it possible ?
How could i do ?
Thanks
I must be doing something wrong, but when I try to add an image to a slide then i down load and open the ppt i get a blank image shape in the slide.
I am running the latest version of phppowerpoint from trunk.
and here is the code I am using to create my slide with image:
//creating next slide
$currentSlide = $powerpoint->getActiveSlide();
$slide = $powerpoint->createSlide();
$shape = $slide->createRichTextShape();
$shape->setHeight(200);
$shape->setWidth(900);
$shape->setOffsetX(30);
$shape->setOffsetY(50);
$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER );
$textRun = $shape->createTextRun("Numbers of Cases and proportion (%) of Any FASD in " . $_SESSION["NUMBIRTHS"] . " Women from ". $_SESSION["LOCATION"] . " in " . $_SESSION["DATE"] . ".");
$textRun->getFont()->setBold(true);
$textRun->getFont()->setSize(30);
$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '555555' ) );
//adding an image to the slide
$shape2 = $slide->createDrawingShape();
$shape2->setName('Alcohol Exposure');
$shape2->setDescription('Pie Chart');
$shape2->setPath('./pictures/51dab21966436.jpg');
$shape2->setHeight(170);
$shape2->setOffsetX(100);
$shape2->setOffsetY(100);
If any one can tell me where I am going off the path or give me some pointers I would be grateful.
-Joel
In PHPPowerPoint_DocumentLayout l180 and l191
public function setLayoutXmilli(integer $pValue) {
$this->_cx = $pValue * 36000;
$this->_layout = PHPPowerPoint_DocumentLayout::LAYOUT_CUSTOM;
return $this;
}
public function setLayoutYmilli(integer $pValue) {
$this->_cy = $pValue * 36000;
$this->_layout = PHPPowerPoint_DocumentLayout::LAYOUT_CUSTOM;
return $this;
}
there is a cast with integer which cause the error:
"must be an instance of integer, integer given"
No charts displayed.
No tables displayed
It seems that PowerPoint
is a registered trademark of Microsoft.
I suggest to rename into PHPPresentation
.
Taking the following code from the samples folder:
$currentSlide = $objPHPPowerPoint->getActiveSlide();
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPowerPoint logo')
->setDescription('PHPPowerPoint logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
$shape->getShadow()->setVisible(true)
->setDirection(45)
->setDistance(10);
Adding the following line to add a hyperlink to the image doesn't seem to work.
$shape->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPowerPoint/')
->setTooltip('PHPPowerPoint');
Documentation :
Validator :
Don"t generate Line Shape
I have an issue that happens randomly (at least is how it looks to me). I can not reporduce it but my users see it regularly.
When I open a PPTX and saves it back, some spaces in text are disapearing.
For example :
<a:r>
<a:rPr b="1" dirty="0" err="1" lang="fr-FR" smtClean="0" sz="1600"/>
<a:t>Adengo</a:t>
</a:r>
<a:r>
<a:rPr b="1" dirty="0" lang="fr-FR" smtClean="0" sz="1600"/>
<a:t>est </a:t>
</a:r>
<a:r>
<a:rPr b="1" dirty="0" lang="fr-FR" sz="1600"/>
<a:t>utilisable sur tous </a:t>
</a:r>
becomes
<a:r>
<a:rPr b="1" lang="fr-FR" smtClean="0" sz="1600"/>
<a:t>Adengoest</a:t>
</a:r>
<a:r>
<a:rPr b="1" dirty="0" lang="fr-FR" smtClean="0" sz="1600"/>
<a:t/>
</a:r>
<a:r>
<a:rPr b="1" dirty="0" lang="fr-FR" sz="1600"/>
<a:t>utilisable sur tous </a:t>
</a:r>
I can't find a pattern leading to this bug.
Any idea why I see it ?
Is there something to do in Powerpoint to prevent it ? (Userers on my website are willing to do some simple manipulation in PowerPoint if this error can be avoided)
or is this a real bug ?
Hi,
Don't you have a webhook configured for packagist?
Would be realy helpful to get the updates via composer.
it would be really useful to be able to set the "auto shrink text" ability in powerpoint, especially when creating powerpoint slides dynamically with text.
I'd be happy to help out to develop this if someone could give me some pointers.
Hi. I want to set document properties for an exiting file ... I know how i can set properties but i can't load a existing file ... i asked about like this in phpword and i can load but for powerpoint i can't load something like that.
please help me. thanks a lot
Documentation suggests that function setHyperlink() receives a PHPPowerPoint_Shape_Hyperlink object as input parameter but the function receives a PHPExcel_Cell_Hyperlink object in PHPPowerPoint_Shape_RichText_TextElement on line 124.
The same applies for PHPPowerPoint_Shape on line 379.
/**
* Set Hyperlink
*
* @param PHPPowerPoint_Shape_Hyperlink $pHyperlink
* @throws Exception
* @return PHPPowerPoint_Shape
*/
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{
$this->_hyperlink = $pHyperlink;
return $this;
}
Hi,
How can i save the ppt in 2003 format.
I have set setOffice2003Compatibility to true (with $objWriter->setOffice2003Compatibility(true);) , still its not working for 2003. I m not able to open ppt.
Is there a workaround.
Thanks
Add ODPWriter as writer
I'm trying to use this (and great work so far btw), but I have quite a few questions...
I know I can get the width of a slide using $slide->getLayout()->getLayoutXmilli()
, which is in millimeters. I've confirmed this was accurate when I opened the generated file.
But what units do the setWidth etc... functions take? I opened up the a pptx file where I created a "1000" unit width item, and it was 10.42 inches wide. I'm not sure how that's supposed to correspond...?
How can I create a text shape that fills the slide exactly?
Is there a way to set the background of a slide?
Don't display the image in LibreOffice.
The image is well in ODP ZIP File.
When I follow any sample, I'm experiencing an error upon opening the pptx files in Powerpoint 2010 (and 2007) :
"Powerpoint has found a problem with the content in xxxxx.pptx
Powerpoint can attempt to repair the presentation.
If you trust the source of this presentation, click Repair."
By clicking on the repair button, the pptx in fine with a popup :
"powerpoint remove unreadable content"
You are telling composer that the namespace "PHPPowerPoint" exists within src/, it doesn't.
All your code is within PhpOffice\PhpPowerpoint.
Please fix.
The following code 'works' but the resulting chart crashes Powerpoint quite frequently.
The .pptx does open and the chart does appear, but the x-axis has a strange format and Powerpoint itself becomes very slow when this chart is present.
Is this a known issue? Is there a way to fix it?
See code below.
$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function
$seriesData = array(
67520 => 4.7461,
162240 => 11.4258,
326080 => 15.6445,
356160 => 25.1367,
406720 => 27.9492,
416960 => 29.3555,
477760 => 33.5742
);
$lineChart = new PHPPowerPoint_Shape_Chart_Type_Scatter();
$series = new PHPPowerPoint_Shape_Chart_Series('Series Name', $seriesData);
$lineChart->addSeries($series);
$shape = $currentSlide->createChartShape();
$shape->setName('TheChartName')
->setResizeProportional(false)
->setHeight(550)
->setWidth(700)
->setOffsetX(120)
->setOffsetY(80);
$shape->getPlotArea()->setType($lineChart);
Hello !
Thanks for your works.
When a create richText on my slide, i have a error :
"PowerPoint was unable to display some of the text, images, or objects on slides in the file, "FileName", because they have become corrupted. Affected slides have been replaced by blank slides in the presentation and it is not possible to recover the lost information. To ensure that the file can be opened in previous versions of PowerPoint, use the Save As command (File menu) and save the file with either the same or a new name."
However, it's ok for draw/image and table.
I use powerpoint 2007 to open files.
Same issue with samples of project : it's ok for table/draw but not sample with text.
Thank you for your reply.
Is it possible to create an image shape inside a table cell?
(PhpPowerpoint\Style\Bullet::TYPE_BULLET );
Is showing up as dash.
The text is always vertically aligned to the top of the box.
The bar3D display nothing.
The fill is not used : I change the background color and no changes in appareance.
When you create a richText shape and set the vertical alignment to "VERTICAL_BASE" or leave the default value, the "a:bodyPr" attribute "anchor" is set to "base" wich is wrong and results in a repair error message. The "anchor" attribute is of type "ST_TextAnchoringType".
Valid values can be found here: http://www.datypic.com/sc/ooxml/t-a_ST_TextAnchoringType.html
Steps to reproduce:
$shape = $slide->createRichTextShape();
$shape->setWidth(20);
$shape->setHeight(17);
$shape->setOffsetX(26);
$shape->setOffsetY(20);
$shape->getActiveParagraph()->getAlignment()->setHorizontal(\PhpOffice\PhpPowerpoint\Style\Alignment::HORIZONTAL_CENTER);
$textRun = $shape->createTextRun("test");
$textRun->getFont()->setSize(8);
$textRun->getFont()->setColor( new \PhpOffice\PhpPowerpoint\Style\Color( "000000" ) );
To fix this you have to do it like with the "a:tcPr" Element. But there is a little mistake, too! Not realy a mistake but a wrong variable name. The vertical align is stored in $horizontalAlign (line 628) Perhaps you want to fix this, too...
Anyway... in Writer/PowerPoint2007/Slide.php change line 422 from
$objWriter->writeAttribute('anchor', $shape->getActiveParagraph()->getAlignment()->getVertical());
to
$verticalAlign = $shape->getActiveParagraph()->getAlignment()->getVertical();
if ($verticalAlign != Alignment::VERTICAL_BASE && $verticalAlign != Alignment::VERTICAL_AUTO) {
$objWriter->writeAttribute('anchor', $verticalAlign);
}
I have a problem when loading an external template (pptx). it reverses the order of the images already present in the template.
see the code below:
$objWriter->setLayoutPack(new PHPPowerPoint_Writer_PowerPoint2007_LayoutPack_TemplateBased(sfConfig::get('sf_upload_dir').'/temoignage/template.pptx'));
thank you for your help
It seems that PowerPoint
is a registered trademark of Microsoft.
From looking at the code (Writer/PowerPoint2007/Slide.php) it looks like Fill is only implemented for Table, and Border is only implemented for Table, Line and Pic.
Is it possible for them to be implemented for RichTextShape as well? This used to work in the older versions before PHPPowerPoint switched to namespaced classes.
Hi everyone,
I finally managed to get PHPExcel working with the latest version of PHPPowerPoint. When I run sample 8, the file opens correctly in PowerPoint it looks fine plus I can view and edit the chart. When I import it via OpenOffice (Version 3.4.1), the slides looks both different and the data is not attached.
BTW: Using the ODT writer the chart data exists. However, the diagram does not look like expected either.
Regards
Roland
Hi,
My server passed on the requirement checks
(phpinfo: http://app.dbhost.in/nfo.php)
But after running your sample script, the generated pptx throw error when opening :
"PowerPoint found a problem with content in Sample_01_Simple.pptx.
PowerPoint can attempt to repair the presentation.
If you trust the source of this presentation, click Repair."
I have attached the generated sample 1,2 for your easy investigating.
https://app.box.com/s/gyb0nc38zhkch7gz327k
Or you can view the direct link here:
http://app.dbhost.in/tmp/PHPPowerPoint/samples/
Please take a look
Thanks,
Minh
I cannot get presentations with slides containing charts with spreadsheets to work. I think the references to PHPExcel in Writer\PowerPoint2007\Chart.php not will comply with the PHPExcel autoloader, unless there is a backslash in the beginning?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.