I'm trying to put a 2 columns table in a new MSWord document using java2word but I'm unable to fix the width of the columns. Here the code:
Table tbl = new Table();
tbl.addTableEle(TableEle.TH, "Descriptions", "");
tbl.setRepeatTableHeaderOnEveryPage();
tbl.addTableEle(TableEle.TD, "Description", "cette case sert à afficher les détails");
tbl.addTableEle(TableEle.TD, "pers appelées", "Marc, Stéphane, Bernard");
tbl.addTableEle(TableEle.TD, "liste", "vide pour l'instant");
tbl.addTableEle(TableEle.TD, "Fonctions", "Chef, administrateur, employé");
tbl.addTableEle(TableEle.TD, "code", "select * from personne");
myDoc.addEle(tbl);
myDoc.addEle(new BreakLine(2));
I would like to set the width of the 1th column to [3 cm], and also make the 1th column unwrappable (doesn't split the row in 2 rows).
Is anybody can help ?
The new code look like this now:
Table tbl = new Table(3.0f, 14.0f); //Sizes of the columns in cm
tbl.addTableEle(TableEle.TH, "Descriptions", "");
tbl.setRepeatTableHeaderOnEveryPage();
tbl.addTableEle(TableEle.TD, "Description", "cette case sert à afficher les détails");
tbl.addTableEle(TableEle.TD, "pers appelées", "Marc, Stéphane, Bernard");
tbl.addTableEle(TableEle.TD, "liste", "vide pour l'instant");
tbl.addTableEle(TableEle.TD, "Fonctions", "Chef, administrateur, employé");
tbl.addTableEle(TableEle.TD, "code", "select * from personne");
myDoc.addEle(tbl);
myDoc.addEle(new BreakLine(2));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.