[Solved] Code to increase ComboBox ListEntrySource?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ken johnson
Volunteer
Posts: 918
Joined: Sun May 31, 2009 1:35 am
Location: Sydney, Australia

[Solved] Code to increase ComboBox ListEntrySource?

Post by ken johnson »

I'm trying to extend a combobox's ListEntrySource by one more row.

Code: Select all

ThisComponent.Sheets.GetByName("On-Site Job Form").DrawPage.GetByIndex(17).Control.ListEntrySource.CellRange.EndRow
returns 90.
Unfortunately when I try

Code: Select all

ThisComponent.Sheets.GetByName("On-Site Job Form").DrawPage.GetByIndex(17).Control.ListEntrySource.CellRange.EndRow=91
nothing changes, it seems to be read-only.
How can I add an extra row to the combobox's ListEntrySource?

Ken Johnson
Last edited by ken johnson on Sat Oct 19, 2013 2:12 am, edited 1 time in total.
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Code to increase ComboBox ListEntrySource?

Post by Villeroy »

ken johnson wrote:How can I add an extra row to the combobox's ListEntrySource?
Insert new cells.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Code to increase ComboBox ListEntrySource?

Post by Villeroy »

Villeroy wrote:
ken johnson wrote:How can I add an extra row to the combobox's ListEntrySource?
Insert new cells.
I think anything is better than this one:

Code: Select all

addr = createUnoStruct("com.sun.star.table.CellRangeAddress")
addr.EndRow=11
dim initParam(0) as new com.sun.star.beans.NamedValue
initParam(0).Name="CellRange"
initParam(0).value = addr
oCellRangeListSource=ThisComponent.createInstanceWithArguments("com.sun.star.table.CellRangeListSource", initParam )
With ThisComponent.DrawPages(0).Forms(0).getByName("Combo Box 1")
	.setListEntrySource(oCellRangeListSource)
End With
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
ken johnson
Volunteer
Posts: 918
Joined: Sun May 31, 2009 1:35 am
Location: Sydney, Australia

Re: Code to increase ComboBox ListEntrySource?

Post by ken johnson »

Villeroy wrote:Insert new cells.
Great solution Villeroy, thank you very much!

Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
Post Reply