Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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....



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
merging cells and eliminating spaces for empty cells Jill Excel Discussion (Misc queries) 2 April 2nd 10 07:43 PM
Formula for merging cells/re sizing cells Mathicas Excel Discussion (Misc queries) 1 September 29th 08 08:16 PM
merging cells together but keeping all data from the cells Pete C[_2_] Excel Discussion (Misc queries) 3 May 16th 08 10:14 PM
Merging cells Al_baker Excel Discussion (Misc queries) 5 December 6th 06 02:01 PM
Merging cells stuart Excel Worksheet Functions 3 January 7th 05 04:34 PM


All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"