How to automatically repeat table heading ?

as title, I want to convert a lot of RTF files which contains long tables , so I hope LibreOffice can automatically repeat table heading when I use the command like “soffice --headless --convert pdf *.rtf”;

I try to assign a Macro to the action “Open the document”, it works in GUI mode, but when I try to combine it with the pervious command , it doesn’t work, I don’t know why
soffice --headless --convert-to pdf tefbas05a.rtf "vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application"

My VBA code

sub Main
rem define variables
dim document as object
dim dispatcher as object
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
dispatcher.executeDispatch(document, “.uno:HeadingRowsRepeat”, “”, 0, Array())
end sub

already answered here Running Writer macros in --invisble or --headless mode