How to add text between sections

I have two adjacent sections, both contain text from other files via links.
Sections are not editable. I cannot find a way to insert anything between these sections.

Build ID: 1:6.2.5-0ubuntu0.19.04.1
CPU threads: 4; OS: Linux 5.0; UI render: default; VCL: gtk3;
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded


Click at the end of the first section and press Alt+Enter


What is the API command to execute “Alt Enter” in that case?

I have a cursor placed at the end of the section, but did not find an API trick to insert text after the section…

Hi Olivier

Sorry for the delay: holiday out of connection :slight_smile:

I do not know of any specific API method. So I would proceed as follows (memorize the section, insert the paragraph, delete the section, restore the section)

sub AltEnter
dim oDoc as object, oText  as object, oCursor  as object, oSection as object
dim PB as integer
dim avant as object

oDoc = thiscomponent
oText = oDoc.Text
oSection = oDoc.textSections.getByName("pys1")
avant = oSection.anchor
oCursor = oText.createTextCursorByRange(oSection.Anchor.end)
oText.insertControlCharacter(oCursor, PB, false)
oSection = oDoc.createInstance("")
end sub

Best regards
1 Like

Thanks PYS for the suggestions.

There is no simple statement to insert “ALT+Enter” at the end of a section, so I had to mimick with cursor movements:

    oSecDA = ThisComponent.getTextSections().getByName("SEC_DISPLAYAREA")
    vCursor = Thiscomponent.CurrentController.getViewCursor()
    oPara = ThisComponent.createInstance("")
    ' Insert the empty paragraph after the Text Section
    Vcursor.Text.insertTextContentAfter ( oPara, oSecDA )