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.

Version: 6.2.5.2
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

Hi

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

Regards

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

PB =com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK
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.dispose
oSection = oDoc.createInstance("com.sun.star.text.TextSection")
oSection.attach(avant)
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")
    Thiscomponent.CurrentController.select(oSecDA.Anchor.End)
    vCursor = Thiscomponent.CurrentController.getViewCursor()
    vCursor.gotoEnd(false)
    oPara = ThisComponent.createInstance("com.sun.star.text.Paragraph")
    ' Insert the empty paragraph after the Text Section
    Vcursor.Text.insertTextContentAfter ( oPara, oSecDA )
    vCursor.goDown(1,false)