title: How to change background color of a cell/group in a Pixel Report in NPrinting Designer using C#
body: <p>In NPrinting Designer (in the Pixel Perfect format) there is an option to use Conditional format which will color fonts/backgrounds according to a condition. This works for the 'rows' of a container/table but the same logic cannot be applied to the 'total' which is in a separate container/table. </p>
  
  <p>That's why I am trying to solve the problem with the total using the script editor of NPrinting Designer.</p>
  
  <p>Qlik has created a video where they demonstrate how you can output a table with top 10 rows using the following C# code:</p>
  
  <p>Link: <a href="https://www.youtube.com/watch?v=iL-qmau233k" rel="nofollow noreferrer">https://www.youtube.com/watch?v=iL-qmau233k</a></p>
  
  <pre><code>//C# code for printing the first 10 rows
  using System.Drawing.Printing;
  
  private int detailRowCount = 0;
  private int topNRow = 20;
  
  private void Detail_BeforePrint(object sender, PrintEventArgs e) 
  {
          if(++detailRowCount &gt; topNRow)
                  e.Cancel = true;
  }
  </code></pre>
  
  <p>I am not an expert in C# code at all but I have tried to use the same logic to achieve the conditional coloring of the total row:</p>
  
  <pre><code>using System.Drawing.Printing;
  
  //C# code for printing conditional coloring/colorting based on values 
  
  Color redColor = Color.FromArgb(255, 0, 0);
  Color greenColor = Color.FromArgb(0, 255, 0);
  
  private void ColorBackground(object sender, ColorEventArgs e) 
  {
          if(e.CellValue &gt; 0) 
          {
                  e.Cell.ColorBackground = Color.redColor;
          }
          else if(e.CellValue &lt;= 0) 
          {   
                  e.Cell.ColorBackground = Color.greenColor;
          }
  }
  </code></pre>
  
  <p>This is what I would like to achieve in pseudo-code:</p>
  
  <p>Around 100 reports (imagine one for each region of a country).</p>
  
  <p>When total > 0 Then color background of that container red</p>
  
  <p>Else color background of that container green.</p>
  
  <p>When I validate the code in the script editor of NPrinting Designer I get the following error:</p>
  
  <pre><code>The type or namespace name 'ColorEventArgs' could not be found (are you using a directive or an assembly reference?)
  </code></pre>
  
  <p>The error message probably makes sense but again as I am not familiar with C# and just using this as my last option I would like to know how I can move on from here.</p>
  
  <p>Any ideas?</p>