Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border and Fill don't work for RichTextShapes. #61

Closed
jarredholman opened this issue Nov 10, 2014 · 11 comments
Closed

Border and Fill don't work for RichTextShapes. #61

jarredholman opened this issue Nov 10, 2014 · 11 comments

Comments

@jarredholman
Copy link

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.

@timwhitlock
Copy link

+1 for this.
I've been trying to fill text shapes and wondering what I was doing wrong.

@JewrassicPark
Copy link
Contributor

I just got this to work with text shapes because I figured it would be way less resource intensive then allocating php images to make solid shapes.

I had to open up powerpoints i made with fills and compare the xml to what phppowerpoint outputted. You can get it to work by adding

"$this->writeFill($objWriter, $shape->getFill());"

after the a:prstGeom element is added

so in the writeShapeText function of the Slide class in the Powerpoint2007 writer folder change the block that starts with // a:prstGeom

to this

    // a:prstGeom
    $objWriter->startElement('a:prstGeom');
    $objWriter->writeAttribute('prst', 'rect');
    $objWriter->endElement();
    $this->writeFill($objWriter, $shape->getFill());

Also make sure your fill is a 6 length color (so for black use 000000 and not FF000000 when setting the RGB)

@pat123456
Copy link

why this don't work ? richtextShape extends abstractShape, it should be able to have fill ?

rotation don't work too in .odp

@Progi1984
Copy link
Member

@jarredholman or @timwhitlock Have you got a sample source code for testing ? And a PPTX with the final render ?
May be have you got tested the "patch" of @JewrassicPark : is it ok for you ?

@timwhitlock
Copy link

I've not tried the patch. The project I was working on has been delivered without fill support.

@Progi1984
Copy link
Member

@jarredholman @timwhitlock @JewrassicPark : Hi all, I fix this issue in the develop branch. Could you test it ? I added a sample (Sample_09_Fill.php) for test. Thanks you for advance.

@Gyzmoo
Copy link

Gyzmoo commented Dec 16, 2014

Hi Progi,

Thx for reply and fix in the develop branch, i've test the new Sample_09_Fill and all seems ok with Fill in RichTextShape

However, i would like to add Border on a RichTextShape, i've try to debug the xml content of my file.ppt but it's not easy.

Here is my code for Borders on RichTextShape:

$shape->getBorder()->setLineStyle(Border::LINE_SINGLE)->setDashStyle(Border::DASH_SOLID)->setColor($colorBlack);

var_dump($shape->getBorder());

On my debug (var_dump), my object shape with borders seems good, however, i dont have any borders on my file.ppt

Any ideas ? Borders are working on Text or RichTextShape ?

Thx for advice

@Progi1984
Copy link
Member

@Gyzmoo Sorry, i just correct fill and not borders. I work on it. :)

@Progi1984
Copy link
Member

@jarredholman @timwhitlock @JewrassicPark @Gyzmoo : Hi all, I fix this issue in the develop branch. Could you test it ? I added a sample (Sample_10_Border.php) for test. Thanks you for advance.

@Gyzmoo
Copy link

Gyzmoo commented Dec 19, 2014

OK i've tested your Sample_10_Border and my own test on my template, borders works on RichText now, thank you!

@Progi1984
Copy link
Member

I close so.

@Progi1984 Progi1984 self-assigned this Dec 19, 2014
@Progi1984 Progi1984 modified the milestones: 0.3.0, 0.4.0 Dec 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants