title: Exception when open excel: File contains corrupted data
body: <p>I am trying to read an excel with OpenXML.
  What I did is simply as following:</p>
  
  <pre><code>private WorkbookPart wbPart = null;
  private SpreadsheetDocument document = null;
  public byte[] GetExcelReport()
  {
      byte[] original = File.ReadAllBytes(this.originalFilename);
      using (MemoryStream stream = new MemoryStream())
      {
          stream.Write(original, 0, original.Length);
          using (SpreadsheetDocument excel = SpreadsheetDocument.Open(stream, true))
          {
              this.document = excel;
              this.wbPart = document.WorkbookPart;
              UpdateValue();
          }
          stream.Seek(0, SeekOrigin.Begin);
          byte[] data = stream.ToArray();
          return data;
      }
  }
  </code></pre>
  
  <p>I initialized this.originalFilename in the constructor. It is the filename ended with '.xlsx' which i created with excel 2010.</p>
  
  <p>But this line of code </p>
  
  <p>using (SpreadsheetDocument excel = SpreadsheetDocument.Open(stream, true))</p>
  
  <p>gives the exception: Message: System.IO.FileFormatException: File contains corrupted data.
  The StackTrace:
  <img src="https://i.stack.imgur.com/Pp4vP.png" alt="enter image description here"></p>
  
  <p>Does anyone know how to solve this problem? At the beginning, I didn't use the Stream, I just use SpreadsheetDocument.Open(filename, true). However, it turns out to be exactly the same exception.
  I've tried to create a new .xlsx file, but it's still the same.</p>