title: R datatable Button with conditional formatting
body: <p>I want to create a shiny app performing a database query. The (simple) idea is to create a table, apply conditional formatting on the columns and allow the reported table to save to excel. I tried different solutions, but the usage of a datatable download-button seemed the most convenient. </p>
  
  <p>After extensive search I managed to apply a download button (updated dt-package from github) and to apply a specific formatting (formatStyle) in the browser display of the shiny-app. This will allow me in future to apply conditional formatting for the unique columns. However, when using the save-button this formatting gets lost in the saved file (See code fragment below). </p>
  
  <p>In my understanding, the reason for this is that the formatStyle function is only applied after the datatable-call. Would there be a way to apply the formatStyle function earlier? The reason for creating the resulttab-object is, that the formatStyle-function is applied on specific columns selected by their names, while the tabelle-function is generated in the shiny reactive-environment. </p>
  
  <pre><code>output$tab &lt;- DT::renderDataTable({
     resulttab &lt;- tabelle() 
      datatable(resulttab, extensions = 'Buttons', options = list(
        dom = 'Bfrtip',
        buttons = 
          list('copy', 'print', list(
            extend = 'collection',
            buttons = list(list(extend='csv',
                                filename = 'blBericht'),
                           list(extend='excel',
                                filename = 'blBericht'),
                           list(extend='pdf',
                                filename= 'blBericht')),
            text = 'Download')))) %&gt;%  formatStyle('Tribrommethan',  color = 'red', backgroundColor = 'orange', fontWeight = 'bold')
        })
  </code></pre>