Hi Pat,

One trick shown on the World Tour to manipulate 4D View Pro data is to export 
the data to an object, manipulate the object and then import it back to the 
View Pro area.

Creating a span in the first row merging column 1 to 5, can be done as follows:

$vpAreaName:="ViewProArea"

$vpObject:=VP Export to object ($vpAreaName) //get the View data into a 4D 
object

$span:=New object         //create our span object
$span.col:=0                 //row and column indexes start at 0
$span.colCount:=5
$span.row:=0
$span.rowCount:=1

If (Undefined($vpObject.spreadJS.sheets.Sheet1.spans))             //if there 
are no spans yet in the sheet, this collection will not exist
        $vpObject.spreadJS.sheets.Sheet1.spans:=New collection
End if 
$vpObject.spreadJS.sheets.Sheet1.spans.insert(0;$span)

VP IMPORT FROM OBJECT ($vpAreaName;$vpObject) //put it back to the area

One caveat though. The sheet name (Sheet1) is used as object property name. 
Above code will not work if the user has changed the sheet name. I haven't 
looked how to make this 'foolproof'. It might be an implementation mistake as 
the sheet objects have a property 'name' too.

HTH
Koen

> Op 21 mei 2019, om 16:01 heeft Pat Bensky via 4D_Tech <[email protected]> 
> het volgende geschreven:
> 
> 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?



--------------------
Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Aalter
Belgium
tel +32 495 511.653

**********************************************************************
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]
**********************************************************************

Reply via email to