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
Nichelle HubleyNichelle Hubley 

Visualforce, excel - defining cell width and borders.

I'm almost successful creating an excel file but I need some help to style two more things:
1) Cell borders - There is a border around the whole table, but I also need each cell to have a border. I tried using this css, which does give the cell borders in the VF page, but not in the excel doc. 
table.details td {
    border: 1px solid black;
      }
2) Cell width - I used a td class to set the width of the column in the VF page but again, the style does not render in the excel file.

Can anyone help with this?

The full page code is here for reference;
<apex:page standardController="Dumping_Grounds__c" >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

 <style type="text/css">


  body {
   font-family: Calibri;
   font-size:10pt;
  }

  p {
      font-family: Arial;
      font-size: 10pt;
      }
  table.details {
      border: 1px solid black;
      border-collapse: collapse;
      }

  table.details td {
    font-size:11pt;
    font-family: Calibri;
    border: 1px solid black;
    

  }
  br {
      mso-data-placement:same-cell;
      }
  .head {
      background-color: #C1EEF5;
      text-align: center;
      font-size: 18pt;
      }
  .title {
      font-size: 16pt;
      font-weight: bold;
      }
  .instructions {
      font-size: 16pt;
      font-style: italic;
      color: red;
      }
  .blue {
      background-color: #C1EEF5;
      font-size: 14pt;
      font-style: bold;
      }
      .col1 {
      width: 400px;
      }
      .col2 {
      width: 200px;
      }
</style>

</head>
<body>


       <table >
         <tr >
             <td colspan="2" class="title">DAS Canada - Legal Expense Insurance</td>
         </tr>
         <tr>
             <td colspan="2" class="instructions">Instructions: Please complete and email to underwriting@das.ca</td>
         </tr>
         <tr>
             <td><br/></td>
         </tr>
         </table>

       <table class="details">
           <tr >
               <td colspan="2" class="head">DASbusiness - Application</td>
           </tr>
           <tr>
               <td colspan="2" class="blue">Broker Information</td>
           </tr>
           <tr>
               <td class="col1" >Broker name</td>
               <td class="col2"> Richard Little</td>
           </tr>
           <tr>
               <td>Broker office</td>
               <td>{!Dumping_Grounds__c.Agency__c}</td>
           </tr>
           <tr>
               <td>Broker Contact Tel Number:</td>
               <td>1-855-505-1525 ext 102</td>
           </tr>
           <tr>
               <td>Date this Application Completed:</td>
               <td>{!Dumping_Grounds__c.CreatedDate}</td>
           </tr>
           <tr>
               <td colspan="2" class="blue">Client Details</td>
           </tr>
           <tr>
               <td>Client/Business Name:</td>
               <td>{!Dumping_Grounds__c.Contact_First_Name__c} {!Dumping_Grounds__c.Contact_Last_Name__c}/{!Dumping_Grounds__c.Business_Name__c}</td>
           </tr>
           <tr>
               <td>Client Full Address:</td>
               <td>{!Dumping_Grounds__c.Business_Street__c}, {!Dumping_Grounds__c.Business_City__c}, {!Dumping_Grounds__c.Business_Province__c}, {!Dumping_Grounds__c.Business_Postal_Code__c}, {!Dumping_Grounds__c.Business_Country__c}</td>
           </tr>
           <tr>
               <td>Client Full Business Description:</td>
               <td>{!Dumping_Grounds__c.Client_Full_Business_Description__c}</td>
           </tr>
           <tr>
               <td>Client Annual Payroll:</td>
               <td></td>
           </tr>
           <tr>
               <td>Client Annual Revenue:</td>
               <td></td>
           </tr>
           <tr>
               <td>Client Email Address:</td>
               <td>{!Dumping_Grounds__c.Contact_Email_Address__c}</td>
           </tr>
           <tr>
               <td>Client Phone #:</td>
               <td>{!Dumping_Grounds__c.Contact_Phone_Number__c}</td>
           </tr>
           <tr>
               <td>Policy Subsidiary Companies</td>
               <td><apex:outputText value="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c == '0', 'No', 'Yes')}"/></td>
           </tr>
           <tr>
               <td>Please List all Subsidiary Company Names if applicable:</td>
               <td><apex:outputText rendered="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c = '0', false,true)}">{!Dumping_Grounds__c.Subsidiary_Account_Name1__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Name2__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Name3__c}</apex:outputText></td>
           </tr>
           <tr>
               <td>Please List all Subsidiary Company Addressses if applicable:</td>
               <td><apex:outputText rendered="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c = '0', false,true)}">{!Dumping_Grounds__c.Subsidiary_Account_Address1__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Address2__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Address3__c}</apex:outputText></td>
           </tr>
           <tr>
               <td>How should policy be sent?</td>
               <td>Email</td>
           </tr>
           <tr>
               <td>Required Policy Start Date:</td>
               <td>{!Dumping_Grounds__c.Policy_Start_Date__c}</td>
           </tr>
           <tr>
               <td colspan="2">Has this company had two or more legal disputes that could have given rise to a claim under this policy in the past three years? <br/>{!Dumping_Grounds__c.Legal_Claims_Risk__c}</td>
               
           </tr>
           <tr>
               <td colspan="2">Note <br/>{!Dumping_Grounds__c.Legal_Claims_Risk_Explanation__c}</td>
               
           </tr>
           <tr>
               <td colspan="2" class="blue">Total Premium Calculated:</td>
           </tr>
           
       </table>

</body>
</apex:page>


 
Best Answer chosen by Nichelle Hubley
shashi lad 4shashi lad 4
Hi ,

I have used it before and what i found out is when we use styling class, it does not work. But if you try in-line styling, it will work.. give a try.

thanks
shashi