function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Render as PDF, DataTable vertical lines

I have a dataTable like below.  I want a border between each column, AND I can do that for each line that is renderend in the table... BUT I have the "height:240px;" set in the style, and my borders don't go down for the entire height of the table.  


I've tried using the Frame, Rules, and ColumnClasses attributes - none of them seem to effect it at all.  Any suggestions?




Here is my markup...

<!-- Main Table -->
<apex:dataTable value="{!invoiceItems}" var="ii" cellPadding="5" cellspacing="0" width="750" style="border:1px solid black;height:240px;" headerclass="tableHeader" >
<apex:column headervalue="quantity" value="{!ii.quantity}" width="80" style="text-align:center;" />
<apex:column headervalue="description" value="{!ii.description}" width="350" />
<apex:column headervalue="ref.#" width="60" />
<apex:column headervalue="unit price" width="115" />
<apex:column headervalue="amount" width="145" style="text-align:right;" >
<apex:outputText value="{0,number,$##,##0.00}" >
<apex:param value="{!ii.amount}" />

Saurabh DhobleSaurabh Dhoble

I tried it out and it works fine for me. You might want to try couple of things :-

(A) Get your datatable out of a pageblocksection - this affects your table styling

(B) Remove all the extra styling etc. and create a bare bones datatable, and see if that works.


Here's my VF page and the result :-


<apex:page standardController="Account" extensions="MyAccountController">
            	<apex:dataTable id="theTbl" value="{!AccountObject}" var="acc" width="100%" rules="all" style="border:3px solid black;height:200px">
                	<apex:column headerValue="Name" value="{!acc.Name}"/>
                    <apex:column headerValue="Description" value="{!acc.Description}"/>
                    <apex:column headerValue="Id" value="{!acc.Id}"/>



Thanks for looking into this.


What about - if you take your height from 200 to 400?  Do the column borders extend all the way to the bottom of your table?  Even if there is only enough data to cover 200px?



Saurabh DhobleSaurabh Dhoble

Yeah, I tried with 400px, and also with 800px. Here's my code with 800px set :-


<apex:dataTable id="theTbl" value="{!AccountObject}" var="acc" width="100%" rules="all" style="border:3px solid black;height:800px">

 And here's what it looks like on the screen :-



It's weird why the gridlines won't go down for you. Can you do a "View Source" & post the HTML that the page is rendering. Also, a screenshot of how your screen looks like would be very helpful too (I use for uploading images).


Well - I'm rendering as PDF - I wonder if that has something to do with it.


I finally filled the rest of my table with blank entries - that's going to take care of it.


Thanks for  your help