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

Padding, positioning, and event emitting additions/enhancements #12

Closed
wants to merge 3 commits into from

Conversation

clintonium-119
Copy link

@clintonium-119 clintonium-119 commented Nov 9, 2017

Thanks for the great work on this library. It really helped out on a project of ours recently.

Our PDF's required some fairly customized formatting, so I had to fork this repo to add in some needed functionality, and I thought I should submit a PR in case you think some or all of it would be a welcome addition.

Here's the summary of my changes:

  • Emitting before and after events for adding cell borders and backgrounds
    • needed for customizing individual cell and row background styles
  • Added a 'pos' attribute to control the table positioning within the document
    • we have a multi-column layout, and need tables to be able to be positioned in any X position, as well as staying in the appropriate column after page breaks
  • Sending the row index through to the onRowAdd and onCellBackgroundAdd event emitters
    • our use case was for zebra (even-odd) fill styles
  • Passing the padding.right value to the custom renderer
    • needed for determining separate right padding in custom renderer
  • Incorporated padding fixes from @MichielDeMey's fork with recommended fix requested in his PR

Sorry to have all this wrapped into a single PR.
Let me know if you have any questions about any of it, or would like any changes made.

For reference, I've added a couple of screenshots of the layouts we were able to achieve with these changes in place.

Thanks again for the great work :)
custom row and cell styling
custom table positioning

MichielDeMey and others added 3 commits February 23, 2017 18:16
- Introduces 2 new properties
  - `row._renderedContent.contentHeight` which will be the actual content size of the cell
  - `column. headerPadding` which can be used to set the padding for the header separately from the body

- Adds `bottomMargin` to the bottom of the table.
- Fixes borders so they look more like a table
…ounds

* Added a 'pos' attribute to control the table positioning within the document
* Incorporated padding fixes from MichielDeMey's fork with recommended fix requested in his PR
* Sending the row index through to the onRowAdd and onCellBackgroundAdd event emitters
* Passing the padding.right value to the custom renderer
@MichielDeMey
Copy link

Nice, glad you fixed the outstanding issue from my PR. 👍

@tafel
Copy link
Contributor

tafel commented Nov 15, 2017

Integrated in 0.4.0 release. Thank you!

@tafel tafel closed this Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants