title: C# Interop Excel quickly get cell indentation levels
body: <p>I am trying to quickly load the text values from an excel spreadsheet into a 2d string array (Visual Studio, C#), and maintaining the indentation information is important. I managed to do it (albeit slow) with the following code:</p>
  
  <pre><code>    int indentLevel = msExcelRange.Cells[row, col]).IndentLevel;
      string rawText = msExcelRange.Cells[row, col]).Text;
  
      string spacesString = "";
  
      //Generate spaces-string proportional to indent level
      for(int i = 0; i &lt; indentLevel; i++)
      {
          spacesString  = spacesString + " ";
      }
  
      //Append spaces to emulate indentation level
      return spacesString + rawText;
  </code></pre>
  
  <p>With this function, I just iterate over every single row and column. It was taking 15 minutes to load an entire Excel spreadsheet, so I'm searching for a faster way.</p>
  
  <p>I came across this function which extracts the text more quickly (only a few seconds) :</p>
  
  <pre><code>object[,] rawText = msExcelRange.get_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault);
  </code></pre>
  
  <p>But the indentation level is lost. Is there a similar function to quickly extract indentation?</p>