Inserting multiple rows into an existing table

Creating a macro - Writing a Script - Using the API

Inserting multiple rows into an existing table

Postby sara0109 » Tue May 16, 2017 11:44 am

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.

OpenOffice 4.1.3
Windows 10Pro
Posts: 1
Joined: Tue May 16, 2017 11:39 am

Re: Inserting multiple rows into an existing table

Postby FJCC » Tue May 16, 2017 2:29 pm

This macro add 100 rows to the table called Table1.
Code: Select all   Expand viewCollapse view
oTable = ThisComponent.TextTables.getByName("Table1")
oRows = oTable.getRows()
oRows.insertByIndex(oRows.Count, 100)  ' (Position to insert, number to insert)
AOO 3.4 or 4.1 on MS Windows XP ( before 2013-08-03) or Windows 7
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Posts: 6512
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 10 guests