Inserting multiple rows into an existing table

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sara0109
Posts: 1
Joined: Tue May 16, 2017 11:39 am

Inserting multiple rows into an existing table

Post by sara0109 »

I am trying to help a friend who is writing an Arabic/English dictionary. He uses a table in OpenOffice to record each word and definition. We need to be able to add 50 or a 100 rows at a time into the same table. Is there a way to do this using a macro? I have read several posts regarding adding rows but they all seem to be for more complicated functions. We just need a simple way to add 100 empty rows that contain the same formatting as those above them.

Thanks.
sara0109
OpenOffice 4.1.3
Windows 10Pro
FJCC
Moderator
Posts: 9271
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Inserting multiple rows into an existing table

Post by FJCC »

This macro add 100 rows to the table called Table1.

Code: Select all

oTable = ThisComponent.TextTables.getByName("Table1")
oRows = oTable.getRows()
oRows.insertByIndex(oRows.Count, 100)  ' (Position to insert, number to insert)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply