Hi Pat,
Interesting 4D View Pro question.
I just tried the following code; it merges cells.
Remember that the index to rows and columns is zero based. For example, row #3
is index #2.
This example merges 6 columns at row 4, column 1.
Wrapping the javascript into an object is Miyako's suggestion. It makes the
code easier to read and edit.
—
C_LONGINT($row_count_i)
C_LONGINT($row_i)
C_LONGINT($column_count_i)
C_LONGINT($column_i
C_OBJECT($js)
C_TEXT($objName_vp_t)
C_TEXT($t)
$objName_vp_t:="ViewProArea"
$row_i:=3 // zero based. This is the 4th row.
$column_i:=0 // zero based. This is the 1st column.
$row_count_i:=1
$column_count_i:=6
$js:=New object("val";"";"add";New formula(This.val:=This.val+$1))
$js.add("(function(){")
$js.add("var sheet = Utils.currentSheet;")
$js.add("sheet.addSpan("+String($row_i)+","+String($column_i)+","+String($row_count_i)+","+String($column_count_i)+",
GC.Spread.Sheets.SheetArea.viewport);")
$js.add("})();")
$t:=WA Evaluate JavaScript(*;$objName_vp_t;$js.val;Is text)
—
More details on “addSpan” at:
https://help.grapecity.com/spread/SpreadSheets12/webframe.html#sccellspan.html
<https://help.grapecity.com/spread/SpreadSheets12/webframe.html#sccellspan.html>
Best regards,
Jeremy
> On May 21, 2019, at 10:01 AM, Pat Bensky via 4D_Tech <[email protected]>
> wrote:
>
> I can see how to create cell spans via the user interface, when the toolbar
> is displayed ("merge and center" button) but does anybody know how to do it
> via code?
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************