Hello guys,
Maybe it was discussed but i don't find something to fit my problem ... I have the following code
Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
if (xlApp == null)
{
Console.WriteLine("Excel is not properly installed!!");
return;
}
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
Excel.Range xlRange;
xlWorkBook = xlApp.Workbooks.Add(misValue);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
xlWorkSheet.Name = "Raport generated";
xlWorkSheet.Cells[1, 1] = "ceva";
xlWorkSheet.Cells[2, 1] = "ceva";
xlWorkSheet.Cells[3, 1] = "ceva";
xlWorkSheet.Cells[4, 1] = "ceva";
xlWorkSheet.Cells[5, 1] = "ceva";
xlWorkSheet.Cells[6, 1] = "ceva";
xlWorkSheet.Cells[7, 1] = "ceva";
xlWorkSheet.Cells[8, 1] = "ceva";
xlWorkBook.SaveAs("D:\\Excel.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
Console.ReadKey();
And i want to group the rows from 2 -> 8(having the "+" sign in my excel and when i press it to expand), how can i do that ?
Thank you in advance.
What I have tried:
xlWorkSheet.get_Range(xlWorkSheet.Cells[2, 1], xlWorkSheet.Cells[8, 1]).Group();