title: Multiple pivottable creation using EPPlus
body: <p>Im just starting to use <a href="http://epplus.codeplex.com/" rel="nofollow noreferrer">EPPLus</a> Lib to create &quot;complex&quot; workbooks via C#, and i just ran into some trouble while trying to create two pivot tables.</p>
  <p>The first one creates fine, but when i try to create the second one it doesnt throw any exceptions but when i try to open the worknook using excel it says</p>
  <blockquote>
  <p>&quot;Excel found unreadable content in 'myworkbook.xlsx'. Do you want to
  recover the contents of this workbook? If you trust the source of this
  workbook, clickYes&quot;</p>
  </blockquote>
  <p>And when i press 'yes':</p>
  <blockquote>
  <p>Repair log -&gt;
  Removed Feature: PivotTable report from /xl/pivotTables/pivotTable2.xml part (PivotTable &gt; view) Removed
  Records: Workbook properties from /xl/workbook.xml part (Workbook)
  Repaired Records: Workbook properties from /xl/workbook.xml part
  (Workbook)</p>
  </blockquote>
  <p>Here's the code that i build:</p>
  <pre><code>CreatePivotTable(&quot;Pivot1&quot;, &quot;Pivot1&quot;, rng1);
  CreatePivotTable(&quot;Pivot2&quot;, &quot;Pivot2&quot;, rng2);
      public void CreatePivotTable(string pivotSheet, string pivotName, ExcelRangeBase srcRange)
      {
          if (m_wb.Worksheets[pivotSheet] != null)
              m_wb.Worksheets.Delete(pivotSheet);
  
          var ws = m_wb.Worksheets.Add(pivotSheet);
  
          var pivot = ws.PivotTables.Add(ws.Cells[&quot;A1&quot;], srcRange, pivotName);            
  
      }
  </code></pre>
  <p>Any ideas?</p>
  <p>Thanks!</p>