Writer Table Columns Access via Java API

fxruby fxruby at siberas.de
Mon May 6 09:00:37 UTC 2019


Hello,

I'm currently writing a program using the libreoffice java api.
It's a programm controlling the Writer component. I can insert tables,
place images inside the table and also change the height of table rows.
Now I want to change the width of a table column. But when I try to get
a column, I always get an empty object.

Here's what I do (it's JRuby code, but very similar to java):

[27] pry(main)> table.java_object
=>
[Proxy:1640296160,7f207000c9b0;gcc3[0];d5b23e2451b4b4a295c975776715,Type[com.sun.star.text.XTextTable]]>
[28] pry(main)> columns = table.columns
=> #<Java::Default::$Proxy60:0x5b799640>
[29] pry(main)> columns.java_object
=>
[Proxy:1534694976,7f207c000de0;gcc3[0];d5b23e2451b4b4a295c975776715,Type[com.sun.star.table.XTableColumns]]>
[30] pry(main)> columns.getCount
=> 12
[31] pry(main)> col = columns.getByIndex 0
=> nil

I always get nil :(

There's some kind of functionality behind the method, because if I enter
a wrong index, an exception is raised

[32] pry(main)> col = columns.getByIndex 13
Java::ComSunStarLang::IndexOutOfBoundsException:
from
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(com/sun/star/lib/uno/environments/remote/Job.java:158)
[33] pry(main)>

Is this a bug or what am I doing wrong?

kind regards,

Andy


More information about the LibreOffice mailing list