Ask Your Question
0

Filling combobox problem

asked 2018-05-15 17:43:43 +0200

Fede gravatar image

updated 2018-05-15 17:44:15 +0200

Hello, I would like to filling the combobox with the elements in range "E7:E48", but I don't understand the problem....

    oSheet = ThisComponent.getSheets().getbyname("Prova")
    oMyCombo = oSheet.DrawPage.Forms.getByName("Formulario").getByName("Id_model")

    oMyCombo.removeAllItems()

    odata = ThisComponent.getSheets().getbyname("Database").getCellRangeByName("E7:E48").DataArray

   oRow = odata(0)

    For i = LBound(oRow) to UBound(oRow)

        oMyCombo.insertItemText (i, oRow(i))

    Next i

Can you help me? Thank you

Libreoffice 6

SO Win10

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2018-05-15 18:51:56 +0200

JohnSUN gravatar image

updated 2018-05-15 19:00:40 +0200

Perhaps you mean it?

oMyCombo.removeAllItems()
For i = LBound(odata) to UBound(odata)
    oMyCombo.insertItemText (i, odata(i)(0))
Next i

Look at the composition of the ODATA array in debug mode image description

edit flag offensive delete link more

Comments

Yes @JohnSUN, ok so "odata" is an 1-dimensional array.. "data(3)(0)" means the element in row 3, and column 0 correct?

How You access to debug mode?

thank you

Fede gravatar imageFede ( 2018-05-16 08:28:10 +0200 )edit

Each element in 1-dimensional array odata is (surprise!) 1-dimensional array. In other words - odata is an array of rows, each element is an array of cells of one row - you understood absolutely correctly (with the amendment that the index 3 denotes the FOURTH row). Debug mode: F9 - set breakpoint, F7 - enable watch of variable, F5 - run macro, F8 - one step of debug, etc.

JohnSUN gravatar imageJohnSUN ( 2018-05-16 08:43:31 +0200 )edit

It's clear, thank you so much!

Fede gravatar imageFede ( 2018-05-16 11:59:29 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-05-15 17:43:43 +0200

Seen: 30 times

Last updated: May 15 '18