![]() |
Merging Cells from C# and Interop
Merging Cells from C# and Interop
Using Excel 2003 I am trying to merge some cells from C# code: Code: Excel.ApplicationClass xApp; //Excel App Excel.Workbook tWB; //Target Workbook Excel.Worksheet tWS; //Target Worksheet Excel.Range tR; //Target Range holder //Start up Excel xApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); //Create the new Workbook and get the sheet tWB = xApp.Workbooks.Add(Type.Missing); tWB.Worksheets.Add(Type.Missing, Type.Missing, 1, Excel.XlSheetType.xlWorksheet); tWS = (Excel.Worksheet)tWB.Worksheets.get_Item(1); //Report Title tR = tWS.get_Range("A1", "M1"); tR.Font.Size = 20; tR.Font.Bold = true; tR.ShrinkToFit = false; tR.MergeCells = true; tR.Value2 = "Summary Revenue Report"; Not sure why the range is never merged, I try the same thing from VBA (using VBA cade) and it works, but this C# does everything but merge the cells.... |
All times are GMT +1. The time now is 03:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com