Page 1 of 1
[Solved] How to split cells by API
Posted: Fri Dec 12, 2014 11:12 am
by Palchaque
Sup, I need some help. I use oo api to automatical export data to excel (from 1c, but you dont know what is it, and its cool to you). But i have some problem - i cannot split/merge cells range. I can take the cells range, changes its colors and values what i need, formats etc, but cannot split it from one. Please, can you give some example for dummies

. Much thank you.
And sorry for my bad english

Re: How to split cells by api
Posted: Fri Dec 12, 2014 11:26 am
by RoryOF
Are you looking to split a cell (i.e, unmerge it) back to its components, or to break data in a cell up into separate components. If this latter, what are the criteria for breaking up the data?
Re: How to split cells by api
Posted: Fri Dec 12, 2014 11:30 am
by Palchaque
I need to merge cells, i dont care about data in it write now. I need to merge some cells to one, then give it a value.
Re: How to split cells by api
Posted: Fri Dec 12, 2014 3:47 pm
by FJCC
Code: Select all
oSheets = ThisComponent.getSheets()
oSheet = oSheets.getByName("Sheet1")
oCellRange = oSheet.getCellRangeByName("A1:A3")
oCellRange.merge(True)
I haven't had time to explore what the boolean argument does in the merge() function.
Re: How to split cells by api
Posted: Fri Dec 12, 2014 4:05 pm
by Palchaque
FJCC wrote:Code: Select all
oSheets = ThisComponent.getSheets()
oSheet = oSheets.getByName("Sheet1")
oCellRange = oSheet.getCellRangeByName("A1:A3")
oCellRange.merge(True)
I haven't had time to explore what the boolean argument does in the merge() function.
Thank you! It works

Re: How to split cells by api
Posted: Fri Dec 12, 2014 5:29 pm
by MTP
FJCC wrote:I haven't had time to explore what the boolean argument does in the merge() function.
.merge(False) splits merged cells.
.merge(True) merges cells, but only if none of the cells in the range are merged. If A1:A2 is merged, then you select A1:B2 and try to merge it, there will be no effect. The macro has to select A1:A2, unmerge them, then select A1:B2 and merge it. Kind of annoying.
Re: How to split cells by api
Posted: Fri Dec 12, 2014 6:37 pm
by FJCC
Thanks!