private TcPrInner.TcBorders copyCellBorderStyles(TableCellBox box) { TcPrInner.TcBorders tcBorders = Context.getWmlObjectFactory().createTcPrInnerTcBorders(); tcBorders.setTop( copyBorderStyle(box, "top", false) ); tcBorders.setBottom( copyBorderStyle(box, "bottom", false) ); tcBorders.setLeft( copyBorderStyle(box, "left", false) ); tcBorders.setRight( copyBorderStyle(box, "right", false) ); return tcBorders; }
return keepNone ? createBorderStyle(STBorder.NONE, null, null) : null; return createBorderStyle(STBorder.NONE, "FFFFFF", BigInteger.ZERO); return createBorderStyle( stBorder, color, BigInteger.valueOf( Math.round(width) ) );
/** * Get table cell margins from table style. * <br>Parameter tableStyle can be null - 0 will be returned. * @return left margin plus right margin (twips) */ private long getTblCellMargins(String tableStyle) { Style s = null; if(tableStyle != null && !tableStyle.isEmpty()) { s = importer.getStyleByIdOrName(tableStyle); } if(s != null && importer.getTableHelper().isTableStyle(s)) { CTTblCellMar cellMar = getTblCellMar(s); if(cellMar == null) { //try "based on" style CTTblCellMar bsCellMar = getBasedOnTblCellMar(s); if(bsCellMar != null) { return getLeftPlusRightMarginsValue(bsCellMar); } } else { return getLeftPlusRightMarginsValue(cellMar); } } return 0; }
tableHelper.nestedTableHierarchyFix(contentContext,parent); tableHelper.setupTblPr( tableBox, tbl, tableProperties); tableHelper.setupTblGrid( tableBox, tbl, tableProperties); tableHelper.nestedTableHierarchyFix(contentContext,parent); mustPop = true; tableHelper.setupTrPr((org.docx4j.org.xhtmlrenderer.newtable.TableRowBox)box, tr); // does nothing at present tableHelper.insertDummyVMergedCells(contentContextStack.peek(), tcb, true); tableHelper.setupTcPr(tcb, tc, tableProperties); tableHelper.insertDummyVMergedCells(trContext, tcb, false);
if (e.getAttribute("class")!=null) { cssClass=e.getAttribute("class").trim(); setTableStyle(tblPr, cssClass); borders.setTop( copyBorderStyle(cssTable, "top", true) ); borders.setBottom( copyBorderStyle(cssTable, "bottom", true) ); borders.setLeft( copyBorderStyle(cssTable, "left", true) ); borders.setRight( copyBorderStyle(cssTable, "right", true) ); borders.setInsideH( createBorderStyle(STBorder.NONE, null, null) ); borders.setInsideV( createBorderStyle(STBorder.NONE, null, null) ); tblPr.setTblBorders(borders); int tableIndentContrib = tableIndentContrib(importer.getContentContextStack()); if (importer.getListHelper().peekListItemStateStack().isFirstChild) {
TcPrInner.TcBorders borders = copyCellBorderStyles(adjCell); borders.setTop( createBorderStyle(STBorder.NIL, null, null) ); tcPr.setTcBorders(borders); this.setCellWidthAuto(tcPr);
tcPr2.setGridSpan(gs); this.setCellWidthAuto(tcPr2); tcPr.setTcBorders( copyCellBorderStyles(tcb) ); TblWidth width = getCellMargin(tcb.getStyle(), "left"); if (width!=null) tcMar.setLeft(width); width = getCellMargin(tcb.getStyle(), "right"); if (width!=null) tcMar.setRight(width); width = getCellMargin(tcb.getStyle(), "top"); if (width!=null) tcMar.setTop(width); width = getCellMargin(tcb.getStyle(), "bottom"); if (width!=null) tcMar.setBottom(width);
setTableStyle(tblPr, cssClass);
tableHelper = new TableHelper(this);