When your searches on Google with LibreOffice don’t give you satisfactory results, search for OpenOffice, it reveals a whole new level of ancient treasure.
I believe you searched for this topic:
https://forum.openoffice.org/en/forum/viewtopic.php?t=41557
I copy over the final answer by Tim Grantham in case that webpage is unavailable:
// Get the TextTablesSupplier interface of the document
XTextTablesSupplier xTableSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, xDoc);
// Get an XIndexAccess of TextTables
XIndexAccess xTables = (XIndexAccess)UnoRuntime.queryInterface(
XIndexAccess.class, xTableSupplier.getTextTables());
int tablecount = xTables.getCount();
for (int i=0; i < tablecount; i++) {
XAutoFormattable xAutoFormattable = ( XAutoFormattable ) UnoRuntime.queryInterface (
XAutoFormattable.class, xTables.getByIndex( i ) );
xAutoFormattable.autoFormat("simpletable_header");
}