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


Java Tc.setTcPr方法代码示例

本文整理汇总了Java中org.docx4j.wml.Tc.setTcPr方法的典型用法代码示例。如果您正苦于以下问题:Java Tc.setTcPr方法的具体用法?Java Tc.setTcPr怎么用?Java Tc.setTcPr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.docx4j.wml.Tc的用法示例。


在下文中一共展示了Tc.setTcPr方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addMergedCell

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/** 
 *  我们创建一个单元格和单元格属性对象. 
 *  也创建了一个纵向合并对象. 如果合并值不为null, 将它设置到合并对象中. 然后将该对象添加到 
 *  单元格属性并将属性添加到单元格中. 最后设置单元格内容并将单元格添加到行中. 
 *  如果合并值为'restart', 表明要开始一个新行. 如果为null, 继续按前面的行处理, 也就是合并单元格. 
 */  
public void addMergedCell(Tr row, String content, String vMergeVal) {  
    Tc tableCell = factory.createTc();  
    TcPr tableCellProperties = new TcPr();  
   
    VMerge merge = new VMerge();  
    if(vMergeVal != null){  
        merge.setVal(vMergeVal);  
    }  
    tableCellProperties.setVMerge(merge);  
   
    tableCell.setTcPr(tableCellProperties);  
    if(content != null) {  
    	tableCell.getContent().add(wmlPackage.getMainDocumentPart(). createParagraphOfText(content));  
    }  
   
    row.getContent().add(tableCell);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:24,代码来源:WordprocessingMLPackageRender.java

示例2: addMergedCell

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/**
 *  我们创建一个单元格和单元格属性对象.
 *  也创建了一个纵向合并对象. 如果合并值不为null, 将它设置到合并对象中. 然后将该对象添加到
 *  单元格属性并将属性添加到单元格中. 最后设置单元格内容并将单元格添加到行中.
 *  
 *  如果合并值为'restart', 表明要开始一个新行. 如果为null, 继续按前面的行处理, 也就是合并单元格.
 */
private static void addMergedCell(Tr row, String content, String vMergeVal) {
    Tc tableCell = factory.createTc();
    TcPr tableCellProperties = new TcPr();
 
    VMerge merge = new VMerge();
    if(vMergeVal != null){
        merge.setVal(vMergeVal);
    }
    tableCellProperties.setVMerge(merge);
 
    tableCell.setTcPr(tableCellProperties);
    if(content != null) {
            tableCell.getContent().add(
            wordMLPackage.getMainDocumentPart().
                createParagraphOfText(content));
    }
 
    row.getContent().add(tableCell);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:27,代码来源:TableWithMergedCells.java

示例3: applyGridSpan

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
private static void applyGridSpan( final Tc cell, final int colSpan, final String rowSpan, int w, boolean mergedVertical ) {
	
    TcPr tcPr = factory.createTcPr();
    TblWidth tblWidth = factory.createTblWidth();
    tblWidth.setType( "dxa" );
    tblWidth.setW( BigInteger.valueOf( w*colSpan ) );
    tcPr.setTcW( tblWidth  );
    
    if ( colSpan > 1) {
        GridSpan gridSpan = factory.createTcPrInnerGridSpan();
        gridSpan.setVal(BigInteger.valueOf(colSpan));
        tcPr.setGridSpan(gridSpan);
    }
    
    if ( mergedVertical ) {
    	//logger.debug(" this is vertical span");
    	VMerge gridVSpan = factory.createTcPrInnerVMerge();
    	if (rowSpan != null)
    		gridVSpan.setVal(rowSpan);
        tcPr.setVMerge(gridVSpan);
                    
    }
   
    cell.setTcPr(tcPr);
}
 
开发者ID:Transkribus,项目名称:TranskribusCore,代码行数:26,代码来源:DocxBuilder.java

示例4: setCellWidth

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/** 
 *  本方法创建一个单元格属性集对象和一个表格宽度对象. 将给定的宽度设置到宽度对象然后将其添加到 属性集对象. 最后将属性集对象设置到单元格中. 
 */  
public void setCellWidth(Tc tableCell, int width) {  
    TcPr tableCellProperties = new TcPr();  
    TblWidth tableWidth = new TblWidth();  
    tableWidth.setW(BigInteger.valueOf(width));  
    tableCellProperties.setTcW(tableWidth);  
    tableCell.setTcPr(tableCellProperties);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:11,代码来源:WordprocessingMLPackageRender.java

示例5: addTableCell

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
public void addTableCell(ObjectFactory factory,
		WordprocessingMLPackage wordMLPackage, Tr tableRow, String content,
		RPr rpr, JcEnumeration jcEnumeration, boolean hasBgColor,
		String backgroudColor) {
	Tc tableCell = factory.createTc();
	P p = factory.createP();
	setParagraphSpacing(factory, p, jcEnumeration, true, "0", "0", null,
			null, true, "240", STLineSpacingRule.AUTO);
	Text t = factory.createText();
	t.setValue(content);
	R run = factory.createR();
	// 设置表格内容字体样式
	run.setRPr(rpr);

	TcPr tcPr = tableCell.getTcPr();
	if (tcPr == null) {
		tcPr = factory.createTcPr();
	}

	CTVerticalJc valign = factory.createCTVerticalJc();
	valign.setVal(STVerticalJc.CENTER);
	tcPr.setVAlign(valign);

	run.getContent().add(t);
	p.getContent().add(run);
	tableCell.getContent().add(p);
	if (hasBgColor) {
		CTShd shd = tcPr.getShd();
		if (shd == null) {
			shd = factory.createCTShd();
		}
		shd.setColor("auto");
		shd.setFill(backgroudColor);
		tcPr.setShd(shd);
	}
	tableCell.setTcPr(tcPr);
	tableRow.getContent().add(tableCell);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:39,代码来源:Docx4J_例子2.java

示例6: setCellWidth

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/**
 *  本方法创建一个单元格属性集对象和一个表格宽度对象. 将给定的宽度设置到宽度对象然后将其添加到
 *  属性集对象. 最后将属性集对象设置到单元格中.
 */
private static void setCellWidth(Tc tableCell, int width) {
    TcPr tableCellProperties = new TcPr();
    TblWidth tableWidth = new TblWidth();
    tableWidth.setW(BigInteger.valueOf(width));
    tableCellProperties.setTcW(tableWidth);
    tableCell.setTcPr(tableCellProperties);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:12,代码来源:SettingColumnWidthForTable.java

示例7: addTableCell

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
public void addTableCell(ObjectFactory factory,
		WordprocessingMLPackage wordMLPackage, Tr tableRow, String content,
		RPr rpr, JcEnumeration jcEnumeration, boolean hasBgColor,
		String backgroudColor) {
	Tc tableCell = factory.createTc();
	P p = factory.createP();
	setParagraphAlign(factory, p, jcEnumeration);
	Text t = factory.createText();
	t.setValue(content);
	R run = factory.createR();
	// 设置表格内容字体样式
	run.setRPr(rpr);
	run.getContent().add(t);
	p.getContent().add(run);
	tableCell.getContent().add(p);

	if (hasBgColor) {
		TcPr tcPr = tableCell.getTcPr();
		if (tcPr == null) {
			tcPr = factory.createTcPr();
		}
		CTShd shd = tcPr.getShd();
		if (shd == null) {
			shd = factory.createCTShd();
		}
		shd.setColor("auto");
		shd.setFill(backgroudColor);
		tcPr.setShd(shd);
		tableCell.setTcPr(tcPr);
	}
	tableRow.getContent().add(tableCell);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:33,代码来源:Docx4J_简单例子.java

示例8: setupTcPr

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
@Override
  protected void setupTcPr(TableCellBox tcb, Tc tc, TableProperties tableProperties) {

/*
 * Reinstate
 * 
	context.getWmlPackage().setUserData(cellId+"#Pr", cell.getTcPr() );
	
	as set by SessionAwareAbstractTableWriter
	
 */

String id = tcb.getElement().getAttribute("id");

if (id==null ) {
	log.debug("no id on tc " );
	
} else {
	log.debug("processing tc with id " + id);

	Object o = wordMLPackage.getUserData(id+"#Pr");
	if (o==null) {
		
		log.debug("no #Pr UserData on tc with id " + id);
	
	} else {
		tc.setTcPr((TcPr)o);
		return;
	}
}

super.setupTcPr( tcb,  tc,  tableProperties);
  }
 
开发者ID:plutext,项目名称:docx-html-editor,代码行数:34,代码来源:RoundtripXHTMLImporter.java

示例9: addTableCellWithMergeStart

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/**
 * Adds a table cell to a row
 * @param tableRow
 * @param content
 * @param factory
 */
private static void addTableCellWithMergeStart(Tr tableRow, P content, ObjectFactory factory) {
	Tc tc = factory.createTc();		
	TcPr tcpr = factory.createTcPr(); 
       tc.setTcPr(tcpr); 
       // Create object for vMerge
       TcPrInner.VMerge tcprinnervmerge = factory.createTcPrInnerVMerge(); 
       tcpr.setVMerge(tcprinnervmerge);
      	tcprinnervmerge.setVal( "restart");
      	tc.getContent().add(content);
	tableRow.getContent().add(tc);
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:18,代码来源:TableWithBorders.java

示例10: addTableCellWithMergeContinue

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
/**
 * Adds a table cell to a row
 * @param tableRow
 * @param content
 * @param factory
 */
private static void addTableCellWithMergeContinue(Tr tableRow, ObjectFactory factory) {
	Tc tc = factory.createTc();		
	TcPr tcpr = factory.createTcPr(); 
       tc.setTcPr(tcpr); 
       // Create object for vMerge
       TcPrInner.VMerge tcprinnervmerge = factory.createTcPrInnerVMerge(); 
       tcpr.setVMerge(tcprinnervmerge);
   	P p = factory.createP(); 
   	tc.getContent().add( p); 
	tableRow.getContent().add(tc);
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:18,代码来源:TableWithBorders.java

示例11: addTableCell

import org.docx4j.wml.Tc; //导入方法依赖的package包/类
public void addTableCell(ObjectFactory factory,  
        WordprocessingMLPackage wordMLPackage, Tr tableRow, String content,  
        RPr rpr, JcEnumeration jcEnumeration, boolean hasBgColor,  
        String backgroudColor) {  
    Tc tableCell = factory.createTc();  
    P p = factory.createP();  
    setParagraphAlign(factory, p, jcEnumeration);  
    Text t = factory.createText();  
    t.setValue(content);  
    R run = factory.createR();  
    // 设置表格内容字体样式  
    run.setRPr(rpr);  
      
    TcPr tcPr = tableCell.getTcPr();  
    if (tcPr == null) {  
        tcPr = factory.createTcPr();  
    }  
      
    CTVerticalJc valign = factory.createCTVerticalJc();  
    valign.setVal(STVerticalJc.CENTER);  
    tcPr.setVAlign(valign);  
      
    run.getContent().add(t);  
    p.getContent().add(run);  
      
    PPr ppr=p.getPPr();  
    if(ppr==null){  
        ppr=factory.createPPr();  
    }  
    //设置段后距离  
    Spacing spacing=new Spacing();  
    spacing.setAfter(new BigInteger("0"));  
    spacing.setLineRule(STLineSpacingRule.AUTO);  
    ppr.setSpacing(spacing);  
    p.setPPr(ppr);  
      
    tableCell.getContent().add(p);  
    if (hasBgColor) {  
        CTShd shd = tcPr.getShd();  
        if (shd == null) {  
            shd = factory.createCTShd();  
        }  
        shd.setColor("auto");  
        shd.setFill(backgroudColor);  
        tcPr.setShd(shd);  
        tableCell.setTcPr(tcPr);  
    }  
    tableRow.getContent().add(tableCell);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:50,代码来源:Docx4J_简单例子2.java


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