ActiveReports 6 Online Help
Merge Method
Example 

The number of vertical rows from the cell to be merged. A value of 1 indicates that only the next cell in the specified direction will be merged.
The number of horizontal columns from the cell to be merged. A value of 1 indicates that only the next cell in the specified direction will be merged.
Merges the cell with adjacent cells.
Syntax
'Declaration
 
Public Sub Merge( _
   ByVal numberOfRowsToMerge As UShort, _
   ByVal numberOfColumnsToMerge As UShort _
) 
public void Merge( 
   ushort numberOfRowsToMerge,
   ushort numberOfColumnsToMerge
)

Parameters

numberOfRowsToMerge
The number of vertical rows from the cell to be merged. A value of 1 indicates that only the next cell in the specified direction will be merged.
numberOfColumnsToMerge
The number of horizontal columns from the cell to be merged. A value of 1 indicates that only the next cell in the specified direction will be merged.
Example
private void btnSpread_Click(object sender, System.EventArgs e)
{
    //Dimension a Workbook and add a sheet to its Sheets collection
    DataDynamics.SpreadBuilder.Workbook sb = new DataDynamics.SpreadBuilder.Workbook();
    sb.Sheets.AddNew();
    //Set up properties and values for columns, rows and cells as desired
    sb.Sheets[0].Name = "Customer Call List";
    sb.Sheets[0].Columns(0).Width = 2 * 1440;
    sb.Sheets[0].Columns(1).Width = 1440;
    sb.Sheets[0].Columns(2).Width = 1440;
    sb.Sheets[0].Rows(0).Height = 1440/4;
    //Header row
    sb.Sheets[0].Cell(0,0).SetValue("Company Name");
    sb.Sheets[0].Cell(0,0).FontBold = true;
    sb.Sheets[0].Cell(0, 0).Merge(0, 1);
    sb.Sheets[0].Cell(0,1).SetValue("Contact Name");
    sb.Sheets[0].Cell(0,1).FontBold = true;
    sb.Sheets[0].Cell(0,2).SetValue("Phone");
    sb.Sheets[0].Cell(0,2).FontBold = true;
    //First row of data
    sb.Sheets[0].Cell(1,0).SetValue("Data Dynamics");
    sb.Sheets[0].Cell(1,1).SetValue("Mortimer");
    sb.Sheets[0].Cell(1,2).SetValue("(614) 895-3142");
    if (sb.Sheets[0].IsMerged(0, 0))
    {
        sb.Sheets[0].Cell(0, 0).UnMerge();
    }
    //Save the Workbook to an Excel file
    sb.Save (Application.StartupPath + @"\x.xls");
    MessageBox.Show("Your Spreadsheet, " + sb.Sheets[0].Columns(0).OwnerSheet.Name + ", has been saved to " + Application.StartupPath + "\\x.xls");
    sb.Sheets[0].Clear();
}
Private Sub btnSpread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpread.Click
    'Dimension a Workbook and add a sheet to its Sheets collection
    Dim sb As New DataDynamics.SpreadBuilder.Workbook
    sb.Sheets.AddNew()
        
    'Set up properties and values for columns, rows and cells as desired
    With sb.Sheets(0)
        .Name = "Customer Call List"
        .Columns(0).Width = 2 * 1440
        .Columns(1).Width = 1440
        .Columns(2).Width = 1440
        .Rows(0).Height = 1440 / 4
        'Header row
        .Cell(0, 0).SetValue("Company Name")
        .Cell(0, 0).FontBold = True
        .Cell(0, 0).Merge(0, 1)
        .Cell(0, 1).SetValue("Contact Name")
        .Cell(0, 1).FontBold = True
        .Cell(0, 2).SetValue("Phone")
        .Cell(0, 2).FontBold = True
        'First row of data
        .Cell(1, 0).SetValue("Data Dynamics")
        .Cell(1, 1).SetValue("Mortimer")
        .Cell(1, 2).SetValue("(614) 895-3142")
     End With
    If sb.Sheets(0).IsMerged(0, 0) Then
        sb.Sheets(0).Cell(0, 0).UnMerge()
    End If
    'Save the Workbook to an Excel file
    sb.Save(Application.StartupPath & "\x.xls")
    MsgBox("Your Spreadsheet, " & sb.Sheets(0).Columns(0).OwnerSheet.Name & ", has been saved to " & Application.StartupPath & "\x.xls")
    sb.Sheets(0).Clear()
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DDCell Class
DDCell Members

Send Feedback