title: Ignoring properties when calling LoadFromCollection in EPPlus
body: <p>I am trying to generate an Excel file using the following code:</p>
  
  <pre><code>public static Stream GenerateFileFromClass&lt;T&gt;(IEnumerable&lt;T&gt; collection, int startrow, int startcolumn, byte[]templateResource)
          {
  using (Stream template = new MemoryStream(templateResource))//this is an excel file I am using for a base/template
      {
          using (var tmpl = new ExcelPackage(template))
          {
              ExcelWorkbook wb = tmpl.Workbook;
              if (wb != null)
              {
                  if (wb.Worksheets.Count &gt; 0)
                  {
                      ExcelWorksheet ws = wb.Worksheets.First();
                      ws.Cells[startrow, startcolumn].LoadFromCollection&lt;T&gt;(collection, false);
                  }
                  return new MemoryStream(tmpl.GetAsByteArray());
              }
              else
              {
                  throw new ArgumentException("Unable to load template WorkBook");
              }
          }
      }
  }
  </code></pre>
  
  <p>This works like a treat, however.. I want to ignore a couple of the properties in my class collection, so it matches up with my template. I know that the <code>LoadFromCollection</code> will generate columns in the Excel file based on the public properties of the class, but as I am loading the class using Entity Framework, if I mark the field as private, then EF complains - mostly because one of the fields I don't want to show is the Key.</p>
  
  <p>I have tried to mark the properties I don't want using <code>[XmlIgnore]</code>, to no avail. Is there any way to do this, short of loading the whole collection into a dataset or some such and trimming the columns out of that? Or casting to a base class without the properties I don't need?</p>