title: Rotate X axis in Excel chart c#
body: <p>I'm trying to rotate the X-Axis text in an Excel chart.<br>
  Here is my current code:</p>
  
  <pre><code>    Excel.Application xlApp;
      Excel.Workbook xlWorkBook;
      Excel.Worksheet xlWorkSheet;
      object misValue = System.Reflection.Missing.Value;
  
      xlApp = new Excel.ApplicationClass();
      xlWorkBook = xlApp.Workbooks.Add(misValue);
  
      xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
      int currentLine = 1;
  
      foreach (int currentKey in currentLogFile.Keys)
      {
            xlWorkSheet.Cells[currentLine, 1] = currentKey;
            xlWorkSheet.Cells[currentLine, 2] = currentLogFile[currentKey];
            currentLine++; 
      }
  
      Excel.Range chartRange;
  
      Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
              Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 250);
      Excel.Chart chartPage = myChart.Chart;
  
      chartRange = xlWorkSheet.get_Range("A1", "B10");
      chartPage.SetSourceData(chartRange, misValue);
  
      chartPage.ChartType = Microsoft.Office.Interop.Excel.XlChartType.xlLine;
  
      chartPage.ApplyLayout(6, Type.Missing);
  
      xlWorkBook.SaveAs(excelOutputFile, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, 
      Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
  
      xlWorkBook.Close(true, misValue, misValue);
      xlApp.Quit();
  </code></pre>
  
  <p>I saw few solutions, like:</p>
  
  <p><a href="https://stackoverflow.com/questions/11991566/how-to-provide-the-custom-angle-to-label-in-excel-using-c-sharp">How to provide the custom angle to label in excel using C#</a>  </p>
  
  <p><a href="https://stackoverflow.com/questions/14779376/changing-axis-labels-on-excel-chart-created-in-c-sharp">Changing Axis Labels on Excel Chart created in C#</a>  </p>
  
  <p><a href="https://stackoverflow.com/questions/6047961/c-sharp-chart-rotate-labels">C# chart rotate labels</a></p>
  
  <p>However I get compilation errors on all of them.</p>