Coder Social home page Coder Social logo

phpoffice / phppresentation Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 508.0 139.29 MB

A pure PHP library for reading and writing presentations documents

Home Page: https://phpoffice.github.io/PHPPresentation

License: Other

PHP 100.00%
hacktoberfest libreoffice-impress mspowerpoint odp office php powerpoint ppt pptx presentation

phppresentation's People

Contributors

aelliott-atlas avatar andreybolonin avatar bjo3rnf avatar brenneisen avatar carusogabriel avatar chriskapp avatar danielbair avatar dees040 avatar delphiki avatar devx2712 avatar djuki avatar fake51 avatar ivanlanin avatar jamesggordon avatar jewrassicpark avatar joshuadoss avatar jrking4 avatar jvanoostrom avatar kw-pr avatar maartenba avatar mindline-analytics avatar mvargasmoran avatar noodlesegg avatar pakku avatar pgee70 avatar progi1984 avatar rdoepke avatar sapfeer0k avatar tcitworld avatar vincentkool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phppresentation's Issues

Use PHPWord as reference

To Do List for having PHPPowerPoints equals to PHPWord Quality :

  • Migrate source from Classes to src
  • Migrate examples from Examples to samples
  • Migrate unit tests from Tests to tests
  • Migrate doc from Documentation to docs
  • Remove Build directory
  • Support of PHP 5.3 min. (Reference : PHPOffice/PHPWord#58 & PHPOffice/PHPWord#77)
  • Add support for Scrutinizer
  • Add composer.lock file
  • Unit Tests to Green (Code Coverage : > 70%)
  • PHPDoc to generate
  • Push PHPDoc & Code Coverage to GitHub Pages
  • ReadTheDocs for PHPPowerPoint
  • Readme.md
  • Having some clean samples : clean existing

set text pre-formatted on slide (without set property by property)

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.

ODP writer is locale sensitive in the wrong places

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.

Add Github Pages

Duplicate PHPOffice/PHPExcel pages and adapt them for PHPPowerPoint

Feature not implemented (l.1131 : 102)

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? ;)

How to read powerpoint files?

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?

can't get(real)Height of richTextShape when auto shrink

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)

Adding an image to a slide gives me a blank image object

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

PHP5.3 Type hinting

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"

How to add link to image?

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');

Implement PPT Reader

Disapearing space

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 ?

Packagist webhook?

Hi,

Don't you have a webhook configured for packagist?
Would be realy helpful to get the updates via composer.

Ability to set auto shrink text

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.

Reader for PowerPoint2007

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

Wrong input parameter object type in setHyperlink()

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;
}

PowerPoint2003

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

A few questions...

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?

BUG : Powerpoint Repair Error

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"

psr-0 via composer broken.

You are telling composer that the namespace "PHPPowerPoint" exists within src/, it doesn't.

All your code is within PhpOffice\PhpPowerpoint.

Please fix.

Scatter chart with numerical X values not working well

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);

Bug when create text

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.

Sample_07_Chart.php : PPTX

The bar3D display nothing.

The fill is not used : I change the background color and no changes in appareance.

BUG: Repair Error / Wrong anchor if you don't set vertical alignment different to VERTICAL_BASE

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);
}

Documentation

  • Basic documentation
  • Table with differences between writers

BUG : Add layout pack with two images

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'));

pb_layout

thank you for your help

Border and Fill don't work for RichTextShapes.

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.

OpenOffice and Charts

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.

openoffice

BTW: Using the ODT writer the chart data exists. However, the diagram does not look like expected either.

Regards
Roland

Open generated pptx file throw error when opening

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

Namespace error on charts with PHPExcel

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.