javaopenoffice.orgopenoffice-writer

Create a table without border


I've managed to create a table:

//I create the table here and the default name is table1
XTextTable xTT = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oInt);
xTT.initialize(1, 1);

However, this create the table with a default border. I would like to create this table without it.

This property is setted by the image

enter image description here


Solution

  • Create the table and then set the border width to 0. Here is a Python example from https://www.mail-archive.com/dev@api.openoffice.org/msg07317.html:

    borderLine = BorderLine()
    borderLine.OuterLineWidth = 0
    
    tableBorder = table.getPropertyValue("TableBorder")
    tableBorder.VerticalLine = borderLine
    tableBorder.HorizontalLine = borderLine
    tableBorder.LeftLine = borderLine
    tableBorder.RightLine = borderLine
    tableBorder.TopLine = borderLine
    tableBorder.BottomLine = borderLine
    table.setPropertyValue("TableBorder", tableBorder)
    

    For a related Java example, search for "TableBorder" on this page: http://api.libreoffice.org/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java