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

added "bgColor" fontStyle, "exactHeight" tableRowStyle and minor modifs for php://output #168

Merged
merged 8 commits into from
Mar 29, 2014

Conversation

jcarignan
Copy link

added "bgColor" fontStyle, "exactHeight" tableRowStyle and minor modifs for php://output

BGCOLOR:

  • Meant to replace fgColor, can use any hex color instead of the 15 color constants in Font.php
  • usage: $section->addText(" myText ", array("bgColor" => "112233"));
  • I found out that spaces after words cannot be highlighted (the same happens with fgColor)
    my temporary fix is replacing all space with the htmlCode of a space so if you really need this feature, add this around line 78 in Word2007/Base.php, just before $objWriter->writeRaw($strText);
    $strText = str_replace(" ", " ", $strText);
  • sample is in samples/Sample_20_BGColor.php

TABLE ROW STYLE EXACTHEIGHT

  • added exactHeight for table row styling
  • mostly for removing the auto-added space after elements in a cell
  • usage: $table->addRow($height, array("exactHeight" => true));
  • sample is in samples/Sample_21_TableRowRules.php

MODIFS PHP://OUTPUT

  • Tmp file should go into sys_get_temp_dir() instead of "./"
  • added content-length header to get the total filesize when downloading

Julien Carignan added 4 commits March 24, 2014 13:44
Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
- mostly for removing the added space after a table
- Code mostly come from this discussion: https://phpword.codeplex.com/discussions/440933
- Usage: $table->addRow(5000, $rowStyle, "exact");

Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
- added content-length header to know the total file size during the download
- Tmp file should go into sys_get_temp_dir() instead of "./"

Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
@jcarignan jcarignan changed the title Develop added "bgColor" fontsyle, "heightRules" for TableRow and minor modifs for php://output Mar 24, 2014
@Progi1984
Copy link
Member

@jcarignan Could you add some unit tests and documentation ?

@Progi1984 Progi1984 added this to the 0.9.1 milestone Mar 26, 2014
@ivanlanin ivanlanin mentioned this pull request Mar 27, 2014
@ivanlanin
Copy link
Contributor

@jcarignan I suggest to use row style (the $style in addRow) to put the height rule. It will be the same like $tblHeader and $cantSplit. We will reduce the number of parameters passed to addRow.

Julien Carignan added 3 commits March 28, 2014 13:26
new usage: $table->addRow($height, array("heightRule"=>"exact"));

Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>
@jcarignan
Copy link
Author

@ivanlanin heightRule is now in row style!
new usage is $table->addRow($height, array("heightRule"=>"exact"));

@Progi1984 Still trying to figure out how to add unit tests, but documentations is coming soon..!

@ivanlanin
Copy link
Contributor

Thanks. I'll review and merge your code ASAP.

@ivanlanin ivanlanin self-assigned this Mar 28, 2014
@jcarignan
Copy link
Author

@ivanlanin Seems like the other values of heightRule are useless to users ("auto" and "atLeast"):
If we don't set an height to the row, the heightRule is set to "auto" and it uses the height of the content.
If we do set an height to the row, heightRule is set to "atLeast" and the row can have a greater height than the content.

So I think it'll be better to change the variable to a boolean exactHeight => true

@ivanlanin
Copy link
Contributor

So the condition is like this, right?

  • height set, hRule = auto
  • height not set, hRule = atLeast (default) | exact

If so, I agree with you. It's easier to use boolean.

@jcarignan
Copy link
Author

other way around!
height set, hRule = atLeast (default) | exact
height not set, hRule = auto

@ivanlanin
Copy link
Contributor

Ups, my bad :) Are you going to re-push you commit? Can you sync yours with the current version of develop branch? You can find out how to do that in this manual. Tell me if you have any difficulties either in merging fork or creating unit tests.

@jcarignan
Copy link
Author

just pushed another commit, new usage:
$table->addRow($height, array("exactHeight" => true));

I'll try to sync now (I'm using tortoise)

@ivanlanin
Copy link
Contributor

Ok. Take your time. I'm off for a while.

@jcarignan jcarignan changed the title added "bgColor" fontsyle, "heightRules" for TableRow and minor modifs for php://output added "bgColor" fontStyle, "exactHeight" tableRowStyle and minor modifs for php://output Mar 28, 2014
ivanlanin added a commit that referenced this pull request Mar 29, 2014
- Comment header('Content-Length:'): HTTP header should not be in class that can be called via CLI
- Incorporate temporary location to ODT and RTF
- Update documentation
- Add unit tests
@ivanlanin ivanlanin merged commit 612ad85 into PHPOffice:develop Mar 29, 2014
@ivanlanin
Copy link
Contributor

Merged with some modifications. I removed HTTP header from Word2007 writer class since PHPWord should also can be called from CLI.

Thank you @jcarignan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants