Você cria um modelo, e cria marcadores nos pontos que você precisa alterar textos e onde deseja criar a tabela com os dados.
é bem semelhante ao método utilizado no Word com indicadores....
segue um exemplo abaixo.
DEFINE VARIABLE hSM AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hDesktop AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hDocument AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hText AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hCursor AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hCursor2 AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hTable AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hRows AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hRow AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE Args1 AS RAW NO-UNDO.
DEFINE VARIABLE Args2 AS RAW NO-UNDO.
CREATE "com.sun.star.ServiceManager" hSM.
hDesktop = hSM:createInstance("com.sun.star.frame.Desktop").
hDocument = hDesktop:loadComponentFromURL("file:///c:/seuModelo.ott","_blank",0,Args1).
hText = hDocument:getText().
hCursor = hText:createTextCursor().
hDocument:Bookmarks:getByName("ind_Nome"):Anchor:setString("JOAO MARIA").
// INCERE TABELA
hDocument:currentController:viewCursor:gotoRange(hDocument:BookMarks:getByName("ind_Tabela"):Anchor,FALSE).
hCursor = hDocument:currentController:getviewCursor().
hCursor:gotoStartOfLine(FALSE).
// tabela com 3 linhas e 4 colunas incluindo a linha de cabecalhos
DEF VAR i-linhas AS INT NO-UNDO INIT 3.
DEF VAR i-colunas AS INT NO-UNDO INIT 4.
hTable = hDocument:createInstance("com.sun.star.text.TextTable").
/* Cria Tabela */
hTable:initialize(i-linhas,i-colunas).
/* Insere Tabela */
hText:insertTextContent(hCursor, hTable, false).
hTable:HoriOrient = 0.
/* Alinhamento Tabela */
hTable:LeftMargin = 0.
hTable:RightMargin = 0.
/* Seleciona Primeira Linha */
hRows = hTable:getrows().
hRow = hRows:getByIndex(0).
/* Seta Novo Cursor */
hCursor2 = hTable:createCursorByCellName("A1").
/* Cria Cabecalho na primeira Linha */
hTable:getCellByName("A1"):setString("PRODUTO").
hTable:getCellByName("B1"):setString("EMBAL").
hTable:getCellByName("C1"):setString("QTDE").
hTable:getCellByName("D1"):setString("VALOR.(R$)").
// MESCLAR CELULAS A2 ATE C2
// hCursor2:gotoCellByName("A2", False).
// hCursor2:goRight(2, True). /* Move 2 celulas para direita */
// hCursor2:mergeRange().
DEF VAR I-CONT AS INT INIT 2.
DO I-CONT = 2 TO 3:
/* Insere Textos Tabela ******************************/
hTable:getCellByName("A" + STRING(I-CONT)):setstring("A" + STRING(I-CONT)).
hTable:getCellByName("B" + STRING(I-CONT)):setstring("KG").
hTable:getCellByName("C" + STRING(I-CONT)):setValue(STRING(I-CONT)).
hTable:getCellByName("D" + STRING(I-CONT)):setValue(STRING(I-CONT * 2)).
END.
hDocument:storeAsUrl("file:///c:/Relatorio.odt",Args2).
RELEASE OBJECT hSM.
RELEASE OBJECT hDesktop.
RELEASE OBJECT hDocument.
RELEASE OBJECT hText.
RELEASE OBJECT hCursor.
RELEASE OBJECT hTable.
RELEASE OBJECT hCursor2.
RELEASE OBJECT hRows.
RELEASE OBJECT hRow.