I'm trying to rendering a VF page as an excel file and css classes are not being applied when you have something referencing multiple css classes.


    .oneStyle {
        background-color: #f00;

    .anotherStyle {
        color: #0f0;
    <td class="oneStyle">Works</td>
    <td class="anotherStyle">Works</td>
    <td class="oneStyle anotherStyle">Doesn't work at all, no styles</td>


I can get around this by by doing inline styling or doing something weird like creating lots of combo styles (ex. oneStyle-anotherStyle) but that's all pretty ridiculous.

Has anyone run into this before? Known issue? I don't expect the Excel rendering engine in Salesforce to be super robust, but this seems like pretty basic CSS support.

Using Summer '15, API v34

1 Answer 1


Salesforce is emitting the HTML you are instructing it to by the markup you include in your page. All that the contentType setting is doing is adding a header that your browser recognises and so forwards the HTML content to Excel. Effectively you've declared that Excel can handle the data.

So it is Excel's limited ability to convert CSS styled HTML into its own formatted spreadsheet cells that you are seeing. It isn't surprising that Excel can only handle simple CSS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .