CSS with Coldfusion and Excel

I was trying to implement a CSS isdefined('variable') for a coldfusion export to excel. The code went some like this for this particular export: (and it worked on the excel export)

  1.  
  2. <style>
  3. td {font-size:<cfif IsDefined(\'xl\')></code>10px;<cfelse>11px;</cfif>}
  4. </style>

Now this worked for simple tags like this because excel recognizes simple html tags on export. However, it would not recognize a simple "a link", not sure why so I had to wrap an cfif statement around a piece of code to not show the link on the excel document. I'm sure excel has it's own styles but for the most part html will directly export into excel on an export. It basically reads td's as cells and of tr's as rows. For example: (however excel doesn't recognize the th tag)

  1.  
  2. <th style="vertical-align:bottom;" nowrap="nowrap" title="Status"></code>
  3. <cfif NOT PWI>
  4. <cfif NOT IsDefined('xl')>
  5. <a href="##" onClick="sortFiles('THRESHOLD_NUM', '#UPDOWN#'); return false">Sched<br>Status</a>
  6. <cfelse>
  7. Sched<br>Status
  8. </cfif>
  9. <cfelse>
  10. Status
  11. </cfif>
  12. </th>
  13.  

So in this case, I couldn't use the th style for excel unless I'm missing something here. Maybe there is a way to disable the link using CSS before exporting to excel.

If anyone have has any thoughts on a simple way of doing this using css, I would love to hear them.

No Comments