 | OO-Snippets: Merge and unmerge cellsCommons| Keywords | merge, unmerge, cell, cells |
|---|
| Language | ooRexx |
|---|
| Application | Calc |
|---|
| Authors | Josef Frysak (initial)
|
|---|
| Supported Versions | 2.4.1 |
|---|
| Supported OS | All |
|---|
| Question | How to merge and unmerge cells?
|
|---|
| Answer | First get the current selection of the selected spreadsheet. Then get the "XMergeable" interface of the selection. With this interface one can find out wheter the selected are merged or not and is able to merge or umerge them. For further details see http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf. |
|---|
x_ScriptContext = uno.getScriptContext()
if (x_ScriptContext <> .nil) then
do
x_ComponentContext = x_ScriptContext~getComponentContext
x_Desktop = x_ScriptContext~getDesktop
x_Document = x_ScriptContext~getDocument
end
else
do
x_ComponentContext = UNO.connect()
service = "com.sun.star.frame.Desktop"
s_Desktop = x_ComponentContext~getServiceManager~XMultiServiceFactory~createInstance(service)
x_Desktop = s_Desktop~XDesktop
x_Document = x_Desktop~getCurrentComponent()
end
x_Model = x_Document~XModel
selection = x_Model~getCurrentSelection()
x_Mergable = selection~XMergeable
if x_Mergable~getIsMerged() then
do
x_Mergable~merge(.false)
end
else
do
x_Mergable~merge(.true)
end
::requires UNO.CLS
|
Changelog| Date | User | Modification |
|---|
| 2008-10-13 | 1 | Initial version |
|