I have the following method implemented in my controller class:
public String buildTemplate(Task task) {
Id taskId = task.Id;
List<Task_History__c> listTaskHistory = [SELECT Field1, Id, Field2, Username__c, LastModifiedDate FROM Task_History__c WHERE Task_ID__c = :taskId];
String pageHTMLContent = '<HTML><HEAD><STYLE>table.css_class , .css_class th, .css_class td { border: 1px solid black; padding: 10px; } table.css_class th { text-align: center; } </STYLE></HEAD><BODY><TABLE class="css_class">';
pageHTMLContent += '<TR><TH>Comment1</TH><TH>Comment2/TH><TH>Last Modified By</TH><TH>Last Modified Date</TH>';
for(Task_History__c taskHistory :listTaskHistory) {
String oldValue = taskHistory.Old_Value__c;
String newValue = taskActivityHistory.New_Value__c;
String userName = taskActivityHistory.Username__c;
DateTime lastModifiedByDate = taskActivityHistory.LastModifiedDate;
pageHTMLContent += '<TR>';
pageHTMLContent += '<TD>' + oldValue + '</TD><TD>' + newValue + '</TD><TD>' + userName + '</TD><TD>' + lastModifiedByDate + '</TD>';
pageHTMLContent += '</TR>';
}
pageHTMLContent += '</TABLE></BODY></HTML>';
return pageHTMLContent;
}
I'd like to move the css "String pageHTMLContent = 'table.css_class , .css_class th, .css_class td { border: 1px solid black; padding: 10px; } table.css_class th { text-align: center; } ';" part in the Visual Force page
<apex:page standardController="task" extensions="TaskHistoryController">
<apex:form >
<apex:pageBlock >
<apex:pageMessages escape="false"/>
</apex:pageBlock>
</apex:form>
</apex:page>
or to an external file?
Could you please give an example how the css would look when implemented in vf page or an external file?