title: Excel Generated by EPPlus is Corrupted
body: <p>I'm using the following code to add a background image to Excel using EPplus.The document opens fine in polaris office but when using Excel it gives the following error </p>
  
  <blockquote>
    <p>We found a problem with some content in 'filename.xlsx'. Do you want to try to recover as much as we can </p>
  </blockquote>
  
  <p>Code</p>
  
  <pre><code> foreach (var file in Filelist)
                  {
  
                      // Load workbook
                      //var fileInfo = new FileInfo(@file);
                      FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
  
                      //ExcelPackage pkg = new ExcelPackage(fs);
  
                      using (var package = new ExcelPackage(fs))
                      {
  
                          // Itterate through workbook sheets
                          foreach (var sheet in package.Workbook.Worksheets)
                          {
  
                              sheet.BackgroundImage.Image = bmp;
                              sheet.Protection.IsProtected = false;
  
                          }
  
                          package.SaveAs(new FileInfo(Path.GetFileNameWithoutExtension(file)+".xlsx"));
                      }
                      fs.Close();
                  }
  </code></pre>
  
  <p>I checked related SO questions , some mentioned that the issue might be due to saving multiple times.I made sure that the Loop is hit only once for a single file.</p>
  
  <p>Update:
  Code for Bitmap Generation </p>
  
  <pre><code> using (Graphics g = Graphics.FromImage(bmp))
              {
                  g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                  g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;         
                  SizeF textSize = g.MeasureString("Sample", new Font(DefaultFont.FontFamily, 80));
                  g.DrawString("Sample", new Font("Tahoma", 80), Brushes.Red, -(textSize.Width / 2), -(textSize.Height / 2));
              }
  </code></pre>