zoukankan      html  css  js  c++  java
  • aspose word for java解决Word中部分表格跨页线框缺失问题

    public void completeTableBorder(Document doc){
        for(Table table:(Iterable<Table>)doc.getChildNodes(NodeType.TABLE, true)){
            //设置表格居中
    				table.setAlignment(TableAlignment.CENTER);
            //设置表格左边框线
    				table.setBorder(BorderType.LEFT, LineStyle.SINGLE, 1, Color.black, true);
            //设置表格右边框线
    				table.setBorder(BorderType.RIGHT, LineStyle.SINGLE, 1, Color.black, true);
            //设置表格上边框线
    				table.setBorder(BorderType.TOP, LineStyle.SINGLE, 1, Color.black, true);
            //设置表格下边框线
    				table.setBorder(BorderType.BOTTOM, LineStyle.SINGLE, 1, Color.black, true);
    				for (Row row:(Iterable<Row>)table.getChildNodes(NodeType.ROW, true)){
    					for (Cell cell:(Iterable<Cell>)row.getChildNodes(NodeType.CELL, true)){
    						//设置单元格上下边框
    						cell.getCellFormat().getBorders().getBottom().setLineStyle(LineStyle.SINGLE);
    						cell.getCellFormat().getBorders().getTop().setLineStyle(LineStyle.SINGLE);
    					}
    				}
    			}
    }
    
  • 相关阅读:
    [Flux] Component / Views
    [Flux] Stores
    [WebStrom] Change default cmd to Cygwin
    [AngularJS] ng-if vs ng-show
    [ES6] Array.find()
    [ES6] Array.findIndex()
    [Javascript] Object.assign()
    [Javascript] Intro to the Web Audio API
    [Falcor] Indroduce to Model
    [Farcol] Introduce
  • 原文地址:https://www.cnblogs.com/haohj/p/10340504.html
Copyright © 2011-2022 走看看