Macro to break external link in text document

I have a text document that has Sections with links to external text files.

I need to break these links to that the document stays independent of the external sources.

I can get the sections with, e.g.

oSec = ThisComponent.getTextSections().getByName("SEC_GUIDE")

But then I can’t find a way to break the external link.

Assigning

oSec.FileLink.FileURL = ""
oSec.FileLink.FilterName = ""

is ineffective to break the link.

Note that with the dialog Format - Sections, I can clear the Link checkbox and I’m done. Less trivial is to do that with a macro.

Note2: I can also break the link with Edit - Links . But don’t know how to get the collection of external links…

Try this:

l = new com.sun.star.text.SectionFileLink
oSec.FileLink = l

Effectively the file link is then broken as demanded. But it also makes the linked contents disappear. My strategy was to break the link and keep the contents.

It is kept here in a sample lorem ipsum file using Version: 7.1.2.2 (x64) / LibreOffice Community
Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4
CPU threads: 12; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

But indeed I might overlook something.