Interop Excel
-
Hi all, i am using Interop for excel. i need to set border style as solid and border color for particular cells. am using the following code, which is not working.... Please correct it...
oRange = (Excel.Range)oSheet.Cells[i, j+1]; oRange.Borders.Weight = BorderStyle.Solid; oRange.Cells.Borders.ColorIndex = 11;
Thanks and regards -
Hi all, i am using Interop for excel. i need to set border style as solid and border color for particular cells. am using the following code, which is not working.... Please correct it...
oRange = (Excel.Range)oSheet.Cells[i, j+1]; oRange.Borders.Weight = BorderStyle.Solid; oRange.Cells.Borders.ColorIndex = 11;
Thanks and regardsWhat error has occurred ?
-
Hi all, i am using Interop for excel. i need to set border style as solid and border color for particular cells. am using the following code, which is not working.... Please correct it...
oRange = (Excel.Range)oSheet.Cells[i, j+1]; oRange.Borders.Weight = BorderStyle.Solid; oRange.Cells.Borders.ColorIndex = 11;
Thanks and regardsHi, maybe you should check out GemBox.Spreadsheet .NET Excel component for reading and writing XLS, XLSX, ODS, CSV and HTML files. Here is an example code how to set border for specified cells:
ExcelFile ef = new ExcelFile();
// Loads Excel file.
ef.LoadXls("filename.xls");// Selects first worksheet.
ExcelWorksheet ws = ef.Worksheets[0];// Set border for selected cells.
cr = ws.Cells.GetSubrange("I2", "L8");
cr.SetBorders(MultipleBorders.Outside, Color.Navy, LineStyle.Dashed);