.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Merging two cells in a row?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1550 Views, 3 Replies

Merging two cells in a row?

Hi all,

 

I am trying to merge two cells in one but i cannot find proper method to do that. Any suggestions?

 

Example:
I am creating a table with dynamic number of rows and columns: 

 for (int i = 3; i < tbRight.NumRows; i++)
                {
                    for (int j = 0; j < tbRight.NumColumns; j++)
                    {
                        if (num2 == numCircles - 1)
                        {
                            Cell c = new Cell(tbRight, i, j);
                            c.TextHeight = 450;
                            tbRight.SetTextString(i, j, (num2 + 1).ToString() + "# - " + rightConn[num2]);
                            num2++;
                            
                        }
                        else if (num2 > numCircles - 1)
                        {   }
                        else
                        {
                            Cell c = new Cell(tbRight, i, j);
                            c.TextHeight = 450;
                            tbRight.SetTextString(i, j, (num2 + 1).ToString() + "# - " + rightConn[num2]);
                            num2++;
                        }
                    }
                }

 First row of the table is the header and i have two free rows with two columns each. I want to merge all of them to look like one row.

 

 

On the other hand, is it possible to align the text in the table in the middle and also the vertical align to be in the middle.

 

Thank you in advance!

3 REPLIES 3
Message 2 of 4
hgasty1001
in reply to: Anonymous

Hi,

 

You can merge cell ranges, like this:

 

Private Sub FormatCells(ByVal ft As Table, ByVal row As Integer, ByVal start As Integer, ByVal fend As Integer)
        Dim rc As CellRange = CellRange.Create(ft, row, start, row, fend)
        ft.MergeCells(rc)
    End Sub

 

Gaston Nunez

Message 3 of 4
Anonymous
in reply to: hgasty1001

hi 

i am getting the error Type 'CellRange' is not defined when i am using cellrange for merging two cells. 

i am using Autocad 2007 and Vb.net 2005.

please help me how to merge two cells in a table using cellrange and table.mergecells()

 

 

 

Message 4 of 4
Anonymous
in reply to: Anonymous

please help me how to merge two cells in a row in vb.net 2005 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report