merge cells in c#

T

texlnghorn

I have read the msdn description of the Merge method and it is
straightforward in VB. However, I am programming in C# and the Merge method
takes 1 arguement which is a reference to the Across object. What are the
valid settings for the object?

Thanks,
Mike
 
A

Alvin Bruney

Here is an example of the merge method

Sub Merge_Cells()
Dim ssConstants
Dim rngMerged

Set ssConstants = Spreadsheet1.Constants

' Merge cells B2:C5.
Spreadsheet1.ActiveSheet.Range("B2:C5").Merge

' Set a variable to the merged range.
Set rngMerged = Spreadsheet1.ActiveSheet.Range("B2").MergeArea

' Format the merged cell.
rngMerged.Borders.Color = "Red"
rngMerged.Borders.Weight = ssConstants.owcLineWeightThick
rngMerged.HorizontalAlignment = ssConstants.xlHAlignCenter
rngMerged.VerticalAlignment = ssConstants.xlVAlignCenter
End Sub

--

________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top