FlexCel Studio for VCL/LCL
ContentsIndex
PreviousUpNext
TFlexCelImport.MergeCells Method

Merges multiple cells into one.

Pascal
procedure MergeCells(const FirstRow: integer; const FirstCol: integer; const LastRow: integer; const LastCol: integer);
C++
__fastcall MergeCells(const int FirstRow, const int FirstCol, const int LastRow, const int LastCol);
Parameters 
Description 
const FirstRow: integer 
First row you want to merge (1 based). 
const FirstCol: integer 
First column you want to merge (1 based). 
const LastRow: integer 
Last row you want to merge (1 based). 
const LastCol: integer 
Last column you want to merge (1 based). 

This method might return a bigger range than the one you specify. For example, if you have a merged cell (A1:C1), calling MergeCells(1,2,2,2) will merge the cell with the existing one, returning ONE merged cell (A1:C2), and not (B1:B2) 

 

Other thing to consider, is that Excel honors individual linestyles inside a merged cell. That is, you can have only the first 2 columns of the merged cell with a line and the others without. Normally, after merging the cells, you will want to set the format on all cells in the range to make them all similar. FlexCel does not do it by default, to give you the choice.

Copyright (c) 2002-2008 TMS Software. All rights reserved.
What do you think about this topic? Send feedback!