B4J Question [xlutils ]Is it possible to create a no-border table?

liulifeng77

Active Member
Licensed User
Longtime User
hi,
I want to make the text look more tidy by creating a ms word table like this:
A A A
B B B
thanks!!
1.jpg
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
1655012378476.png


Based on: https://stackoverflow.com/questions/34092933/set-outer-border-of-apache-poi-xwpftable-table

B4X:
Dim tables As List = doc.XWPFDocument.RunMethod("getTables", Null)
For Each table As JavaObject In tables
    Me.as(JavaObject).RunMethod("removeBorders", Array(table))
Next

...

#if java
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
public static void removeBorders(XWPFTable table) {
    CTTblPr tblpro = table.getCTTbl().getTblPr();
    CTTblBorders borders = tblpro.addNewTblBorders();
    borders.addNewBottom().setVal(STBorder.NONE); 
    borders.addNewLeft().setVal(STBorder.NONE);
    borders.addNewRight().setVal(STBorder.NONE);
    borders.addNewTop().setVal(STBorder.NONE);
    //also inner borders
    borders.addNewInsideH().setVal(STBorder.NONE);
    borders.addNewInsideV().setVal(STBorder.NONE);
}
#End If
 
  • Like
Reactions: LGS
Upvote 0
Top