当前位置: 首页>>代码示例>>Java>>正文


Java CTTcPr类代码示例

本文整理汇总了Java中org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr的典型用法代码示例。如果您正苦于以下问题:Java CTTcPr类的具体用法?Java CTTcPr怎么用?Java CTTcPr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CTTcPr类属于org.openxmlformats.schemas.wordprocessingml.x2006.main包,在下文中一共展示了CTTcPr类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildCellBorder

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
private void buildCellBorder(Border border, XWPFTableCell tableCell,int type) {
	CTTcPr cellPropertie = tableCell.getCTTc().getTcPr();
	if(cellPropertie==null){
		cellPropertie=tableCell.getCTTc().addNewTcPr();
	}
	CTTcBorders borders=cellPropertie.getTcBorders();
	if(borders==null){
		borders=cellPropertie.addNewTcBorders();;
	}
	BorderStyle borderStyle=border.getStyle();
	CTBorder ctborder=null;
	if(type==1){
		ctborder=borders.addNewLeft();
	}else if(type==2){
		ctborder=borders.addNewRight();
	}else if(type==3){
		ctborder=borders.addNewTop();
	}else if(type==4){
		ctborder=borders.addNewBottom();
	}
	if(borderStyle.equals(BorderStyle.dashed)){
		ctborder.setVal(STBorder.DASHED);
	}else if(borderStyle.equals(BorderStyle.doublesolid)){
		ctborder.setVal(STBorder.DOUBLE);
	}else{
		ctborder.setVal(STBorder.SINGLE);				
	}
	int borderWidth=border.getWidth();
	if(borderWidth>1){
		ctborder.setSz(BigInteger.valueOf(DxaUtils.points2dxa(borderWidth)));				
	}
	String color=border.getColor();
	if(StringUtils.isNotBlank(color)){
		ctborder.setColor(toHex(color.split(",")));
	}
}
 
开发者ID:youseries,项目名称:ureport,代码行数:37,代码来源:WordProducer.java

示例2: setCellText

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
private static void setCellText(XWPFDocument xDocument, XWPFTableCell cell, String text, String bgcolor, int width) {
	CTTcPr cellPr = cell.getCTTc().addNewTcPr();
    cellPr.addNewTcW().setW(BigInteger.valueOf(width));
	cell.setColor(bgcolor);
	cell.setVerticalAlignment(XWPFVertAlign.CENTER);
    cell.setText(text);
}
 
开发者ID:xiruibing,项目名称:DBDocTool,代码行数:8,代码来源:Word2007.java

示例3: getGridSpan

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
private static int getGridSpan(XWPFTableCell cell) {
    if (cell == null)
        return -1;
    CTTcPr tcPr = cell.getCTTc().getTcPr();

    if (tcPr == null)
        return 1;

    CTDecimalNumber number = tcPr.getGridSpan();

    if (number == null) {
        return 1;
    }
    else {
        return number.getVal().intValue();
    }
}
 
开发者ID:linzeqipku,项目名称:SnowGraph,代码行数:18,代码来源:WordDocxTableParser.java

示例4: mergeCellsHorizonal

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
/**
 * 合并行单元格
 * @param table
 * @param row
 * @param fromCol
 * @param toCol
 */
public void mergeCellsHorizonal(XWPFTable table, int row, int fromCol,
		int toCol) {
	for (int colIndex = fromCol; colIndex <= toCol; colIndex++) {
		XWPFTableCell cell = table.getRow(row).getCell(colIndex);
		CTTcPr tcPr = cell.getCTTc().getTcPr();
		if (null == tcPr)
			tcPr = cell.getCTTc().addNewTcPr();
		CTHMerge hMerge = tcPr.addNewHMerge();
		if (colIndex == fromCol) {
			// The first merged cell is set with RESTART merge value
			hMerge.setVal(STMerge.RESTART);
		} else {
			// Cells which join (merge) the first one, are set with CONTINUE
			hMerge.setVal(STMerge.CONTINUE);
		}
	}
}
 
开发者ID:Sayi,项目名称:poi-tl,代码行数:25,代码来源:NiceXWPFDocument.java

示例5: mergeCellsVertically

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
/**
 * 合并列单元格
 * @param table
 * @param col
 * @param fromRow
 * @param toRow
 */
public void mergeCellsVertically(XWPFTable table, int col, int fromRow,
		int toRow) {

	for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {

		XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
		CTTcPr tcPr = cell.getCTTc().getTcPr();
		if (null == tcPr)
			tcPr = cell.getCTTc().addNewTcPr();
		CTVMerge vMerge = tcPr.addNewVMerge();
		if (rowIndex == fromRow) {
			// The first merged cell is set with RESTART merge value
			vMerge.setVal(STMerge.RESTART);
		} else {
			// Cells which join (merge) the first one, are set with CONTINUE
			vMerge.setVal(STMerge.CONTINUE);
		}
	}
}
 
开发者ID:Sayi,项目名称:poi-tl,代码行数:27,代码来源:NiceXWPFDocument.java

示例6: isVMerge

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
private static boolean isVMerge(XWPFTableCell cell) {
    if (cell == null)
        return false;
    CTTcPr tcPr = cell.getCTTc().getTcPr();
    if (tcPr == null)
        return false;

    return tcPr.isSetVMerge();
}
 
开发者ID:linzeqipku,项目名称:SnowGraph,代码行数:10,代码来源:WordDocxTableParser.java

示例7: isVMergeRestart

import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; //导入依赖的package包/类
private static boolean isVMergeRestart(XWPFTableCell cell) {
    if (cell == null)
        return false;
    CTTcPr tcPr = cell.getCTTc().getTcPr();
    if (tcPr == null || !tcPr.isSetVMerge())
        return false;

    // 如果不判断isVMerge,会getVMerge==null? NullException Alert!
    return (tcPr.getVMerge().getVal() == STMerge.RESTART);
}
 
开发者ID:linzeqipku,项目名称:SnowGraph,代码行数:11,代码来源:WordDocxTableParser.java


注:本文中的org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。