I have an idea for it. We can pass a two-dimensional array of texts, to a method with presentation options like the following:
doc.table([
["cell11"],["cell21"],["cell31"],
["cell12"],["cell22"],["cell32"],
["cell13"],["cell23"],["cell33"]
],{
width:20,
height:40,
x:30,
y:40
});
Then in the module we make rectangles and texts for each cell.
Issue Analytics
- State:
- Created 12 years ago
- Reactions:13
- Comments:59 (3 by maintainers)
Top Results From Across the Web
Tables & desks - IKEA
From coffee tables to computer desks, and bedside tables to dining sets. A table is a versatile piece of furniture, often multitasking as...
Read more >tables - Amazon.com
This personal folding table is lightweight and portable, making it convenient for indoor and outdoor use.This personal folding table is lightweight and portable ......
Read more >Tables You'll Love in 2022 - Wayfair.com
Shop Wayfair for Tables to match every style and budget. Enjoy Free Shipping on most stuff, even big stuff.
Read more >Accent Tables (Coffee, Console, End & Side Tables)
Accent tables, coffee & side tables for your living room. Find stylish accent pieces, console tables & living room furniture that you'll love...
Read more >Dining Room Tables - Target
Shop Target for Dining Tables you will love at great low prices. Choose from Same Day Delivery, Drive Up or Order Pickup. Free...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi people! I’m developing a function to generate tables, in general my idea is:
Where
data
is an array of rows and each row is rappresented as an object. For example, suppose you want to create an invoice,data
should be something like this:In my opinion, this strategy is more useful than a two dimensional array when you get the data from a database.
The second parameter,
options
, contains a set of options that modify the rendering of the table. An example ofoptions
should be:options.columns.id
is the is ID used to map the column with the corresponding data.options.columns.width
is the percentage of width that the column occupies; this meas that the sum of all width must be 100.options.columns.name
is the name of the column that will be render as an header of the table.options.margins
is the table margin, so it is the distance from the page borders to the table borders.options.padding
is the cell padding, so it is the distance from the cell borders to the text in the cell.What do you think about? any suggestion is appreciated!
Here’s another way inspired by the above.
Call
Method
Result
Hope it helps some of you 👍 Feel free to improve/customize it