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
April RobinsonApril Robinson 

How do I bold the column headers with Render as PDF?

I'm a SQL Server dba who got tasked with creating a Salesforce Visualforce page that renders as PDF only. I'm completely unfamiliar with apex and visualforce. I managed to make a page that works. But they want me to bold the column headings on the table that is displayed there. I tried numerous methods that I found online from "inline styles" to "static resource styles" to "facets" and none of them has any affect on the PDF output at all. Maybe I didn't correctly reference the static resource?  I'm totally lost.  Can anyone point me to some instructions or something? Is there an "Apex syntax for dummies" book? Here's the current rendition of my table although it's probably irrelevant the way it is:

<apex:pageBlockTable border="1" style="font-size:10.0pt;font-family:Arial Unicode MS" value="{!MyCustomObject__c.lses__r}" var="lse">
         <apex:column headerValue="MyColumn1" style="width:20%" value="{!lse.customfield1}" />
         <apex:column headerValue="MyColumn2" style="width:15%"  value="{!lse.customfield2}"/>
         <apex:column headerValue="MyColumn3" style="width:15%" value="{!lse.customfield3}"/>
         <apex:column headerValue="MyColumn4" style="width:15%" value="{!lse.customfield4}"/>
         <apex:column headerValue="MyColumn5" style="width:15%" value="{!lse.customfield5}"/>
         <apex:column headerValue="MyColumn6" style="width:20%" value="{!lse.customfield6}"/>
</apex:pageBlockTable>
 
SFDC_BigDogSFDC_BigDog

Did you try this?

<apex:pageBlockTable border="1" style="font-size:10.0pt;font-family:Arial Unicode MS" value="{!MyCustomObject__c.lses__r}" var="lse">
         <apex:column headerValue="<b>MyColumn1</b>" style="width:20%" value="{!lse.customfield1}" />
         <apex:column headerValue="<b>MyColumn2</b>" style="width:15%"  value="{!lse.customfield2}"/>
         <apex:column headerValue="<b>MyColumn3</b>" style="width:15%" value="{!lse.customfield3}"/>
         <apex:column headerValue="<b>MyColumn4</b>" style="width:15%" value="{!lse.customfield4}"/>
         <apex:column headerValue="<b>MyColumn5</b>" style="width:15%" value="{!lse.customfield5}"/>
         <apex:column headerValue="<b>MyColumn6</b>" style="width:20%" value="{!lse.customfield6}"/>
</apex:pageBlockTable>

Or try this:
<apex:pageBlockTable border="1" style="font-size:10.0pt;font-family:Arial Unicode MS" value="{!MyCustomObject__c.lses__r}" var="lse">
         <apex:column headerValue="MyColumn1" style="font-weight:800,width:20%" value="{!lse.customfield1}" />
         <apex:column headerValue="MyColumn2" style="font-weight:800,width:20%"  value="{!lse.customfield2}"/>
         <apex:column headerValue="MyColumn3" style="font-weight:800,width:20%" value="{!lse.customfield3}"/>
         <apex:column headerValue="MyColumn4" style="font-weight:800,width:20%" value="{!lse.customfield4}"/>
         <apex:column headerValue="MyColumn5" style="font-weight:800,width:20%" value="{!lse.customfield5}"/>
         <apex:column headerValue="MyColumn6" style="font-weight:800,width:20%" value="{!lse.customfield6}"/>
</apex:pageBlockTable>

 
April RobinsonApril Robinson
Yes, I did try both of those methods. The first literally prints the B tags. The second does nothing at all.
SFDC_BigDogSFDC_BigDog
<apex:pageBlockTable border="1" style="font-size:10.0pt;font-family:Arial Unicode MS" value="{!MyCustomObject__c.lses__r}" var="lse">

         <apex:facet name= "header" ><b>MyColumn1</b>  </apex:facet>
         <apex:column  value="{!lse.customfield1}" />

         <apex:facet name= "header" ><b>MyColumn2</b>  </apex:facet>
         <apex:column value="{!lse.customfield2}"/>

         <apex:facet name= "header" ><b>MyColumn3</b>  </apex:facet>
         <apex:column  value="{!lse.customfield3}"/>

        <apex:facet name= "header" ><b>MyColumn4</b>  </apex:facet>
         <apex:column value="{!lse.customfield4}"/>

         <apex:facet name= "header" ><b>MyColumn5</b>  </apex:facet>
         <apex:column value="{!lse.customfield5}"/>

         <apex:facet name= "header" ><b>MyColumn6</b>  </apex:facet>
         <apex:column  value="{!lse.customfield6}"/>
</apex:pageBlockTable>

Try the above and let me know.
April RobinsonApril Robinson
OK, I just tried that and it didn’t work either. I’m getting so frustrated. Thing is, all of these methods seem to work so long as I do NOT render as PDF. But the PDF is a non-negotiable requirement.
April RobinsonApril Robinson
Thanks everyone who tried to help.  I did figure this out on my own thru trial and error. I ended up taking any reference to the font out of the table tag and then putting a  <div> tag in the middle of the Facet.  Very tedious.  Following code is how I controlled the font weight and background color for the column headers:

<apex:pageBlockTable border=".75"  value="{!MyCustomObject__c.lses__r}" var="lse">

    <apex:column style="width:20%">         
        <apex:facet name= "header" >
            <div Style="font-weight:800; font-size:10.0pt; font-family:Arial Unicode MS; background-color:#d3d3d3">
            MyColumn1
            </div>
            </apex:facet>
            {!lse.customfield1}
    </apex:column>
    
    <apex:column style="width:20%">         
        <apex:facet name= "header" >
            <div Style="font-weight:800; font-size:10.0pt; font-family:Arial Unicode MS; background-color:#d3d3d3">
            MyColumn2
            </div>
            </apex:facet>
            {!lse.customfield2}
    </apex:column>

and so on....

</apex:pageBlockTable>