Object Reference : Object View and Procedure Reference : Table
  
 
setmerge
Merges/unmerges one or more table cells.
Syntax
table_name.setmerge(cell_range)
where cell_range describes the table cells (in a single row) to be merged. The cell_range specifications are given by:
 
first_cell[:]last_cell, first_cell[,]last_cell
Left (right) cell of the selection range (specified in “cell” format), followed by right (left) cell of the selection range (specified in “cell” format), separated by a “:” or “,” (e.g., “A2:C2”, “A2,C2”, or “R2C1:R2C3”, “R2C1,R2C3”). Merge all cells in the region defined by the first column and last column for the specified row.
cell_row[,] first_cell_col[,] cell_row[,] last_cell_col
Left (right) cell of the selection range (specified in “row[,] col” format), followed by right (left) cell of the selection range (specified in “row[,] col” format, with a fixed row), separated by a “,” (e.g., “2,A,2,C” or “2,1,2,3”). Merge all cells in the row defined by the first column and last column identifier.
If the first specified column is less than the last specified column (left specified before right), the cells in the row will be merged left to right, otherwise, the cells will be merged from right to left.The contents of the merged cell will be taken from the first non-empty cell in the merged region. If merging from left to right, the left-most cell contents will be used; if merging from right to left, the right-most cell contents will be displayed.
If you specify a merge involving previously merged cells, EViews will unmerge all cells within the specified range.
Examples
tab1.setmerge(a2:d2)
tab1.setmerge(2,1,2,4)
merges the cells in row 2, columns 1 to 4, from left to right.
tab2.setmerge(r2c5:r2c2)
merges the cells in row 2, columns 2 to 5, from right to left. We may then unmerge cells by issuing the command using any of the previously merged cells:
tab2.setmerge(r2c4:r2c4)
unmerges the previously merged cells.
Note that in all cases, the setmerge command must be specified using cells in a single row. The command:
tab3.setmerge(r2c1:r3c5)
generates an error since the cell specification involves rows 2 and 3.
Cross-references
See Table::setwidth, Table::setheight and Table::setjust for details on setting table widths, height, and justification.
For additional discussion of table commands see “Working with Tables and Spreadsheets”.
See also “Table Objects” for a discussion and examples of table formatting in EViews.