List Info

Thread: Calc : merge a cell range




Calc : merge a cell range
user name
2006-09-22 08:22:22
Peter Eberlein schrieb:
> Hi Niklas,
> Niklas Nebel schrieb:
>> Laurent Godard wrote:
>>> merging a cell range is quite easy
>>>
>>> activeSheet =
thiscomponent.currentController.activeSheet
>>> range =
activeSheet.getCellRangeByName("A3:B3")
>>> range.merge(true)
>>>
>>> btw, how can i merge also the datas of all
merged cells so that they 
>>> are displayed in the merged cell (having A3 and
B3 content in merged A3)
>>
>> Read the text from cells A3 and B3, concatenate it,
put it into A3. 
>> Same for notes if you care about them. There's no
separate API.
>>
> btw:
> oRange =
ThisComponent.Sheets(0).GetCellRangeByName("a1:a3&quo
t;)
> oData = oRange.GetDataArray()
> msgBox uBound(oData()) ' gives me 2.
> 
> If I substitute the range with "a1:c1" the
uBound of the array gives me 0.
> Any ideas?

oData() is a 2-dimensional array.

UBound( oData(), 1 )
or
UBound( oData() )

gives the upper limit of the first dimension,

UBound( oData(), 2 )

the second dimension. Access the single values with

for first = 0 to ubound( oData(), 1 )
   for second = 0 to ubound( oData(), 2 )
     ... oData( first, second ) ...
   next
next



Regards
Daniel

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )