Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
How can I display a table with borders?
Also It does not work the Counter Field
Comment | File | Size | Author |
---|---|---|---|
#24 | Display_borders_on_PDF_table-1355440-24.patch | 3.72 KB | vegansupreme |
#23 | template.png | 59.32 KB | milton_segretti |
#23 | no template.png | 14.99 KB | milton_segretti |
#17 | Orders_Items_List.pdf | 7.72 KB | mkozhuharov |
#11 | border-less-content.JPG | 24.84 KB | saqib055 |
Comments
Comment #0.0
aa2007 CreditAttribution: aa2007 commentedQuestion with "width" resolved.
Comment #0.1
aa2007 CreditAttribution: aa2007 commented1
Comment #1
nguyentran CreditAttribution: nguyentran commentedI have the same problem, any help !
Comment #2
kaizerking CreditAttribution: kaizerking commentedsame problem here any help please.
and also if some some can help on following:
1.table with borders
2. setting font size in the rows, currenly only we can set header
3 setting column width
4. if in unformatted setting, how to display multivalue fields -currenly, if it is multivalue field displaying one over the other
please have look at the attached pdf
PS: please clarify if we are styling it with positions, does this means that we cannot generate a dynamic page with multiple values? always same fields and what if user adds more values for the fields ?
Comment #3
nguyentran CreditAttribution: nguyentran commentedHello kaizerking,
I have a temporaly way to add border is
Format>settings> render settings> in PHP Code Before Output ,
You set $border = 1; the same way for other fields, You will get the border.
Setting font size in the rows
Format>settings> Text setting> font size
I don't know how to set width of column.
I have this problem with label, when i check the option 'Create the label', i also have the label in the content (like the pdf file include) Can you help me to fix it. Thanks
Comment #4
nguyentran CreditAttribution: nguyentran commentedThis is file PDF
Comment #5
kaizerking CreditAttribution: kaizerking commentedI am using field collection module which is an entity in it self, So when i am generating a view,views pdf identifies as content type and the label is recognized.at the same time it wont recognize the fields inside the field collection item, that is the reason i am not able to set the format values to the rows and fonts. if i assign any value the will only apply to the label and not the rest of the content
I think the maintainer should consider this, now in D 7- entity , entity reference, bundle are used extensively
For you perhaps if you know coding, you can visit TCPDF and read and see how you could solve your problem, I am not coder
Comment #6
bofrost CreditAttribution: bofrost commented@kaizerking #5
Maybe you have to edit your view and use the fields inside the field collection with a relation...
@nguyentran #3
I think the actual DEV Version will fix your Problem, have a look to this issue http://drupal.org/node/1252660
Comment #7
bofrost CreditAttribution: bofrost commentedComment #8
nguyentran CreditAttribution: nguyentran commentedThank you Drupaldise, the patch work well.
I need your advices for this. I have read a lot on these issues, but i can not find out how to create the table, and how to put the code into the 'Render settings' (the way to use the variables and TCPDF API), i read the examples from http://www.tcpdf.org/examples.php but it not suitable for code in 'Render settings'.
Thanks for helping.
Comment #9
nguyentran CreditAttribution: nguyentran commentedHi, i am using variable $border =1; but it not work as demand (see my included file)
Comment #10
lsolesen CreditAttribution: lsolesen commentedComment #11
saqib055 CreditAttribution: saqib055 commentedhey can some one give me the solution for the border problem.. i see this is deviating from border related problem to field label related problem. #5 solution gives me border to the label but thats not exact solution i suppose.
thank you in advance.
Comment #12
killua99 CreditAttribution: killua99 commentedDear fellow Drupal enthusiasts,
I have set this issue to "Postponed (Maintainer needs more information)".
If not already done please add an issue summary and steps how to reproduce the problem.
And please read again, "Making an issue report".
Help about how to do this can be found on IRC and in the user groups.
After there is new information, please re-open the issue by changing the status to active.
--
This issue was edited with the help of Issue Helper
Comment #13
candelas CreditAttribution: candelas commentedif you use css, you can assign borders to the table (tested on dev)
Comment #14
darkodev CreditAttribution: darkodev commentedConfirming #13
Assign a css file in the pdf settings and add
Now how do I get cell padding?
I set a td class = "description" and tried to add css padding, but no joy.
I can only apply padding to whole table, it seems:
Comment #14.0
darkodev CreditAttribution: darkodev commented1
Comment #15
Priti197 CreditAttribution: Priti197 commented$border = 1; doesn't work to set border for table.
Also CSS file is not getting called, i tried with sites/all/themes.. in CSS url.
No luck!
Please help.
Comment #16
killua99 CreditAttribution: killua99 commentedwith full path ??
Comment #17
mkozhuharov CreditAttribution: mkozhuharov commentedHi everyone,
In my case "$border = 1;" works for table format, but the cells height is different, depends on how much content is in it.
I tried to apply css file but it doesn't work...
Any ideas how I can set the same height per table row ?
Comment #18
rudy2342 CreditAttribution: rudy2342 commentedHello,
"$border = 1;" is not working for me. Whenever I put it into the php code before output, it will just over write my field with the actual text of $border=1; and not apply the border. If i use php tag then the whole field goes blank and there is no border. Am I doing something wrong? Do you just put "$border = 1;" inside PHP Code Before Output under body style?
Thanks
Comment #19
killua99 CreditAttribution: killua99 commentedDid you try #13 ?
Comment #20
killua99 CreditAttribution: killua99 commentedPlease reopen if you have other solutions for this.
Comment #21
Fernly CreditAttribution: Fernly commentedHi,
I'm reopening the issue because it's not working as designed (7.x-1.3) as it is marked now. Both CSS and "$border = 1;" are not working so the table is not themable.
However, when adding classes to values in the table using field rewriting, those can be themed using a CSS file.
So conclusion: values can be themed, the table itself cannot be themed.
Is it a possibility to apply the given CSS file to the whole table instead of applying it to each individual field as it does now (and as it is described when adding a CCS file: URL to a CSS file. This file is attached to all fields, rendered as HTML.)?
To reproduce this issue you simply need to setup a view with a pdf table display (using 7.x-1.3 of views_pdf) and try to theme the table itself by adding borders and paddings using the CSS or PHP methods. If you succeed, I'm really keen to know how it's done.
Greets,
Lennart
Comment #22
lindaweb CreditAttribution: lindaweb commentedIs'nt there any documentation to assist on styling the pdf.
Whats the purpose of having this functionality if one is unable to style the pdf ?
I have tried importing a style sheet, none on the changes reflect. I have tried some of the above mentioned solutions , again with no effect.
I have a drupal system that calculates fields and import secondary content types to compile
estimates according to required templates. Everything is working and being shown in the views pdf, nut the table borders are not showing, the css styling is not snowing .. nothing !!.
I am unabe to add classes to any of the fields
The only value that i see being called in the viewers.css from Firefox.
PLEASE can there be looked at supplying proper documentation on styling views pdf.
Im using Views PDF 1.3 on Drupal 7
This is now becoming a frustrating endless battle.
Comment #23
milton_segretti CreditAttribution: milton_segretti commentedI'm not working with the actual "PDF table" setting but the "PDF Unformatted". My content that is going to make the PDF has an html table in it though. Here are my observations which may be of some use.
If you are using a pdf template, to provide a background image for the pdf for example, it seems to be slotted in-between the text in the table and any borders applied to the table using a css file. Removing the template makes the borders appear. I have added screenshots of the same table with and without the template:
Any inline styles on the html table will override the css file. The table on mine is pasted from excel so there is of course lots of inline styles added.
Comment #24
vegansupreme CreditAttribution: vegansupreme commented@Lindaweb for styling see the bottom of Views PDF Gotchas
I'm pretty sure the tables created by 'PDF Table' format aren't actually HTML tables. So using CSS table styling won't work unless you have a table within your field.
$border = 1;
won't work in PDF Table format for 7.x-1.3 because only unformatted has the bypass PHP_eval option.Here's my workaround:
This patch adds bypass PHP_eval option to PDF table format.
Apply patch.
To add borders to your table, add
$border = 1;
to PHP Code Before Output and check the Use PHP eval box. Do this for every field. This will only put a box around each field, not the whole table. If your fields have different heights it will look weird. See comments #9 and #17. To solve this problem add a$h
value to the PHP before field. This will make the height of each cell consistent, and your table will appear to have borders. You may need to experiment to find the right $h value. This value is in the units specified in the PDF Page Options (mm by default). Unfortunately this value has to be at least as tall as your tallest field—It's not a perfect workaround. If using mm, you could start with$h = 15;
I'l dig around some more in the code to see if there's a better way.
Comment #25
killua99 CreditAttribution: killua99 commentedThis patch should be committed ? or should I wait for some feedback?
Comment #26
vegansupreme CreditAttribution: vegansupreme commentedIt's just applying the same bypass php_eval patch that was applied earlier to unformatted. I think it should be okay.
Comment #27
killua99 CreditAttribution: killua99 commentedAlright. Someone can RTBC ?
Comment #28
maxplus CreditAttribution: maxplus commentedHi,
Thanks for the patch but when using a template pdf, the table borders are gone...
Comment #29
lindaweb CreditAttribution: lindaweb commentedThe tables and the css will only show correctly , if your server PHP config settings are setup correctly.
allow_url_fopen : On
ioncube : Off
display_errors:Off
memory_limit : 64 MB
max_execution_time : 30 Seconds
max_input_vars : 2500 Variables
upload_max_filesize / post_max_size :2 MB
Comment #30
MeeraKB CreditAttribution: MeeraKB commentedTried both CSS file and $border = 1; but didn't get the result .
Comment #31
NWOM CreditAttribution: NWOM commentedThe patch from #24 has already been committed. It appears this issue is outdated.
Comment #32
ladybug_3777 CreditAttribution: ladybug_3777 commentedAdding a comment for anyone like me that is struggling to get this to work properly.
FIRST (and I didn't see this written in the documentation anywhere) in order to even see the options for PHP Code Before/After you MUST have the PHP Filter module installed and enabled. (Huge GOTCHA for me!)
Second, if you are using the latest version you must also click the checkbox "Use the PHP eval function instead of php_eval" or else you won't get a border.
Still experimenting with options, but wanted to put this out there for others
Comment #33
NWOM CreditAttribution: NWOM commentedMarking as bug for the documentation for now then. I ran into this issue as well today again.
Comment #34
killua99 CreditAttribution: killua99 commentedShould I put this info in here?
https://www.drupal.org/docs/7/modules/views-pdf/views-pdf-gotchas
I'm resuming thing here and I got lost with this one
Comment #35
killua99 CreditAttribution: killua99 commented