Comments (15)
Needed that for my app so i added some lines of code to tableProcessor.js;
You use it by adding another function in the layout definition
var layout = {
hLineWidth: function(i, node) { ... },
vLineWidth: function(i, node) { ... },
hLineColor: function(i, node) { ... },
vLineColor: function(i, node) { ... },
//you just return null for the rest
fillColor: function(row, col, node) { return row > 0 && row % 2 ? 'yellow' : null; }
}
here is a plunker to test
Not sure if that will fit well the rest o library but i tested it and it works well (even against variable border sizes)
from pdfmake.
Nice work yelouafi.
Is it possible to assign a cell color inside the code? For example:
[{ text: 'Cell text', style: 'headerTable', colSpan:2, fillColor:'red'},{}]
from pdfmake.
Sorry I was fixing some issues and did some branching reset
Plunker should be working fine now
BTW i changed the usage to a more natural fillColor
style property as @onbermejo commented;
[{ text: ...., fillColor: 'yellow'}]
And since it's style property you can also use the library styling capabilities (style dictionaries, style overrides)
var docDef = {
.....
[{ text: ...., style: 'myCell'}]
.....
styles: {
myCell: { fillColor: 'yellow' }
}
from pdfmake.
Hi, I try to use this library and it's very simple and fun.
But I need to set a style with background color to a table cell..Is it possible?
thanks
from pdfmake.
Not yet
Sorry, I've been very busy during last 3 weeks, I'll get back to pdfmake next week.
from pdfmake.
Ok, thanks for your answer!
from pdfmake.
Hi, sorry, but I need to use this feature.
When do you think will be implemented?
I need this information because I may find another library...
Thanks
from pdfmake.
I would like to add that I could really use this feature as well.
from pdfmake.
Yes, It could be really useful. And It would be great not only to a cell, also to a complete row. Thanks
from pdfmake.
Hmm, I'm not seeing this working in Chrome on plunker. Is this this working?
from pdfmake.
It is working very well!
Thank you @yelouafi
@yelouafi :Before I implement it on my production server, I would like to know if this new library is the same as the original, only with the change of the fillColor? I have been comparing them and there are several changes.
@bpampuch : Are you going to implement this changes to your original file?
It would be great not to divide the project,
Thanks.
from pdfmake.
@onbermejo the only changes are (the master branch includes also the latest builds)
- modified sources files (4): docMeasure, elementWriter, pageElementWriter and tableProcessor
- files in the build directory, those are necessary if you want to use the library on the browser (you should avoid the minified version for now until issues #18 and #60 are fixed)
you can also checkout the tableCellFillColor and run your own builds locally
BTW you may also find it useful to merge the textDecorator
And just a last EDIT: i don't intend to create a new library from this fork; all those features are intended to enhance the main library (which i find awesome to have in the node.js archipel).
as for the integration into the main library i already made this pull requests #82 and #79;
from pdfmake.
Thanks, yelouafi.
I just wasn't sure if I was doing something incorrect at the time or using an unsupported
I appreciate your efforts on this project. You are doing some pretty cool things.
from pdfmake.
PR has been merged
from pdfmake.
Hi
I'd like to create a table with alternating background colors for each row. yelouafi's original approach with the table layout would have worked for me, but I see the fillColor property is now a part of the cell's style itself, which is also practical, but not so handy for what I want. Is there any way to do this without setting a style for each row on my code? Thanks!
from pdfmake.
Related Issues (20)
- Vulnerability [pdfmake] HOT 2
- Critical Vulnerability in crypto-js dependency HOT 1
- show table do not across page HOT 2
- [Feature Request] progressCallback should take img fetching into account
- Vulnerability SNYK-JS-ES5EXT-6095076 in es5-ext HOT 2
- IMPORTANT! Vulnerability SNYK-JS-PDFMAKE-6347243 HOT 28
- Rendering optimization solution for undefined characters in fonts
- How to display Chinese traditional language in PDF using angular version 15 HOT 1
- In Firefox. table lines are visible when using .open() HOT 1
- SVG is not displayed correctly HOT 1
- Image not found in virtual file system but font added the same way is working.
- Removing borders in titles pdfmake file
- Image over canvas in background
- Add accessibility support HOT 2
- Issue with displaying localized numbers
- 自定义字体无法获取, Uncaught (in promise) File 'arialuni.ttf' not found in virtual file system
- encountered an error "javascript heap out of memory" while attempting to generate a PDF using pdf-make
- UI Interface for drag n drop PDF Editor HOT 2
- Cannot read properties of undefined (reading 'tableLayouts') HOT 1
- TypeError: Cannot redefine property: vfs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfmake.