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


Java JcEnumeration类代码示例

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


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

示例1: getHdr

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public Hdr getHdr(WordprocessingMLPackage wordprocessingMLPackage,
		ObjectFactory factory, Part sourcePart, boolean isUnderLine,
		String underLineSize) throws Exception {
	Hdr hdr = factory.createHdr();
	File file = new File("f:/saveFile/tmp/xxt.jpg");
	java.io.InputStream is = new java.io.FileInputStream(file);
	hdr.getContent().add(
			newImage(wordprocessingMLPackage, factory, sourcePart,
					BufferUtil.getBytesFromInputStream(is), "filename",
					"这是页眉部分", 1, 2, isUnderLine, underLineSize,
					JcEnumeration.CENTER));
	if (isUnderLine) {
		hdr.getContent().add(
				createHeaderBlankP(wordprocessingMLPackage, factory,
						underLineSize, JcEnumeration.CENTER));
	}
	return hdr;
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:19,代码来源:Docx4J_例子2.java

示例2: getFtr

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public Ftr getFtr(WordprocessingMLPackage wordprocessingMLPackage,
		ObjectFactory factory, Part sourcePart, boolean isUnderLine,
		String underLineSz) throws Exception {
	Ftr ftr = factory.createFtr();
	File file = new File("f:/saveFile/tmp/xxt.jpg");
	java.io.InputStream is = new java.io.FileInputStream(file);
	ftr.getContent().add(
			newImage(wordprocessingMLPackage, factory, sourcePart,
					BufferUtil.getBytesFromInputStream(is), "filename",
					"这是页脚", 1, 2, isUnderLine, underLineSz,
					JcEnumeration.CENTER));
	if (isUnderLine) {
		ftr.getContent().add(
				createHeaderBlankP(wordprocessingMLPackage, factory,
						underLineSz, JcEnumeration.CENTER));
	}
	return ftr;
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:19,代码来源:Docx4J_例子2.java

示例3: main

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {  
    Docx4J_简单例子 t = new Docx4J_简单例子();  
    WordprocessingMLPackage wordMLPackage = t  
            .createWordprocessingMLPackage();  
    MainDocumentPart mp = wordMLPackage.getMainDocumentPart();  
    ObjectFactory factory = Context.getWmlObjectFactory();  
    //图片页眉  
    //Relationship relationship =t.createHeaderPart(wordMLPackage, mp, factory);  
    //文字页眉  
    Relationship relationship =t.createTextHeaderPart(wordMLPackage, mp, factory, "我是页眉,多创造,少抄袭", JcEnumeration.CENTER);  
    t.createHeaderReference(wordMLPackage, mp, factory, relationship);  
      
    t.addParagraphTest(wordMLPackage, mp, factory);  
    t.addPageBreak(wordMLPackage, factory);  
      
    t.createNormalTableTest(wordMLPackage, mp, factory);  
    //页脚  
    relationship =t.createFooterPageNumPart(wordMLPackage, mp, factory);  
    t.createFooterReference(wordMLPackage, mp, factory, relationship);  
      
    t.saveWordPackage(wordMLPackage, new File(  
            "f:/saveFile/temp/s5_simple.docx"));  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:24,代码来源:Docx4J_简单例子2.java

示例4: createFooterWithPageNr

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public Ftr createFooterWithPageNr(ObjectFactory factory) {  
    Ftr ftr = factory.createFtr();  
    P paragraph = factory.createP();  
    RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA,  
            false, false, false, false);  
    R run = factory.createR();  
    run.setRPr(fontRPr);  
    paragraph.getContent().add(run);  
  
    addPageTextField(factory, paragraph, "第");  
    addFieldBegin(factory, paragraph);  
    addPageNumberField(factory, paragraph);  
    addFieldEnd(factory, paragraph);  
    addPageTextField(factory, paragraph, "页");  
  
    addPageTextField(factory, paragraph, " 总共");  
    addFieldBegin(factory, paragraph);  
    addTotalPageNumberField(factory, paragraph);  
    addFieldEnd(factory, paragraph);  
    addPageTextField(factory, paragraph, "页");  
    setParagraphAlign(factory, paragraph, JcEnumeration.CENTER);  
    ftr.getContent().add(paragraph);  
    return ftr;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:25,代码来源:Docx4J_简单例子2.java

示例5: createFooterWithPageNr

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public Ftr createFooterWithPageNr(ObjectFactory factory) {
	Ftr ftr = factory.createFtr();
	P paragraph = factory.createP();
	RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA,
			false, false, false, false);
	R run = factory.createR();
	run.setRPr(fontRPr);
	paragraph.getContent().add(run);

	addPageTextField(factory, paragraph, "第");
	addFieldBegin(factory, paragraph);
	addPageNumberField(factory, paragraph);
	addFieldEnd(factory, paragraph);
	addPageTextField(factory, paragraph, "页");

	addPageTextField(factory, paragraph, " 总共");
	addFieldBegin(factory, paragraph);
	addTotalPageNumberField(factory, paragraph);
	addFieldEnd(factory, paragraph);
	addPageTextField(factory, paragraph, "页");
	setParagraphAlign(factory, paragraph, JcEnumeration.CENTER);
	ftr.getContent().add(paragraph);
	return ftr;
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:25,代码来源:Docx4J_简单例子.java

示例6: setAlignment

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
/**
 * Gets a center aligned PPr for P
 * @return
 */
private void setAlignment(Tbl table, ALIGN align) {
    if (align!=null) {
    	JcEnumeration jcEnumeration = JcEnumeration.CENTER;
    	switch (align) {
		case LEFT:
			jcEnumeration = JcEnumeration.LEFT;
			break;
		case RIGHT:
			jcEnumeration = JcEnumeration.RIGHT;
			break;
		}
    	ObjectFactory wmlObjectFactory = new ObjectFactory();
    	TblPr tblPr = table.getTblPr();
 		if (tblPr==null) {
 			tblPr = wmlObjectFactory.createTblPr(); 
 			table.setTblPr(tblPr);
 		}
 		Jc jc = wmlObjectFactory.createJc();
 		jc.setVal(jcEnumeration);
			tblPr.setJc(jc); 
    }
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:27,代码来源:PostprocessTable.java

示例7: setAlignment

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
/**
 * Gets a center aligned PPr for P
 * @return
 */
protected PPr setAlignment(ALIGN align) {
	ObjectFactory wmlObjectFactory = new ObjectFactory();
	PPr ppr = wmlObjectFactory.createPPr();
    Jc jc = wmlObjectFactory.createJc();
    JcEnumeration jcEnumeration = JcEnumeration.CENTER;
    if (align!=null) {
    	switch (align) {
		case LEFT:
			jcEnumeration = JcEnumeration.LEFT;
			break;
		case RIGHT:
			jcEnumeration = JcEnumeration.RIGHT;
			break;
		}
    }
    ppr.setJc(jc); 
    jc.setVal(jcEnumeration);
	return ppr;
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:24,代码来源:PostprocessBase.java

示例8: setStyleMLA

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
void setStyleMLA(Style style, boolean justify) {
    ObjectFactory factory = Context.getWmlObjectFactory();
    PPr paragraphProperties = factory.createPPr();
    Jc justification = factory.createJc();
    
    if (justify)
        justification.setVal(JcEnumeration.BOTH);
    else
        justification.setVal(JcEnumeration.CENTER);
    
    paragraphProperties.setJc(justification);
    
    Spacing sp = factory.createPPrBaseSpacing();
    sp.setAfter(BigInteger.ZERO);
    sp.setBefore(BigInteger.ZERO);
    sp.setLine(BigInteger.valueOf(482));
    sp.setLineRule(STLineSpacingRule.AUTO);
    paragraphProperties.setSpacing(sp);
    
    style.setPPr(paragraphProperties);
    
    RPr rpr = new RPr();
    changeFont(rpr, "Times New Roman");
    
    style.setRPr(rpr);
}
 
开发者ID:anubiann00b,项目名称:TextToDocx,代码行数:27,代码来源:Generator.java

示例9: createPageNumParagraph

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
private P createPageNumParagraph() {
	 CTSimpleField pgnum = factory.createCTSimpleField();
        pgnum.setInstr(" PAGE \\* MERGEFORMAT ");
        RPr RPr = factory.createRPr();
        RPr.setNoProof(new BooleanDefaultTrue());
        PPr ppr = factory.createPPr();
        Jc jc = factory.createJc();
        jc.setVal(JcEnumeration.CENTER);
        ppr.setJc(jc);
        PPrBase.Spacing pprbase = factory.createPPrBaseSpacing();
        pprbase.setBefore(BigInteger.valueOf(240));
        pprbase.setAfter(BigInteger.valueOf(0));
        ppr.setSpacing(pprbase);
      
        R run = factory.createR();
        run.getContent().add(RPr);
        pgnum.getContent().add(run);

        JAXBElement<CTSimpleField> fldSimple = factory.createPFldSimple(pgnum);
        P para = createParagraph();
        para.getContent().add(fldSimple);
        para.setPPr(ppr);  
        return para;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:25,代码来源:DocxExporter.java

示例10: setTblAllJcAlign

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
/**
 * @Description: 设置表格水平对齐方式(包括单元格),只对该方法前面产生的单元格起作用
 */
public void setTblAllJcAlign(Tbl tbl, JcEnumeration jcType) {
    if (jcType != null) {
        setTblJcAlign(tbl, jcType);
        List<Tr> trList = getTblAllTr(tbl);
        for (Tr tr : trList) {
            List<Tc> tcList = getTrAllCell(tr);
            for (Tc tc : tcList) {
                setTcJcAlign(tc, jcType);
            }
        }
    }
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:16,代码来源:Docx4j_工具类_S3_Test.java

示例11: setTcJcAlign

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
/**
 * @Description: 设置单元格水平对齐方式
 */
public void setTcJcAlign(Tc tc, JcEnumeration jcType) {
    if (jcType != null) {
        List<P> pList = getTcAllP(tc);
        for (P p : pList) {
            setParaJcAlign(p, jcType);
        }
    }
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:12,代码来源:Docx4j_工具类_S3_Test.java

示例12: createParagraphWithHAlign

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
/** 
 * 创建段落设置水平对齐方式 
 * @return 
 */  
private P createParagraphWithHAlign() {  
    P p;  
    PPr pPr;  
    p = Docx4j_Helper.factory.createP();  
    pPr=Docx4j_Helper.factory.createPPr();  
    Jc jc =Docx4j_Helper.factory.createJc();  
    jc.setVal(JcEnumeration.CENTER);  
    pPr.setJc(jc);  
    p.setPPr(pPr);  
    return p;  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:16,代码来源:Docx4j_Helper.java

示例13: main

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	Docx4J_例子2 t = new Docx4J_例子2();
	WordprocessingMLPackage wordMLPackage = t
			.createWordprocessingMLPackage();
	MainDocumentPart mp = wordMLPackage.getMainDocumentPart();
	ObjectFactory factory = Context.getWmlObjectFactory();

	Relationship relationship = t.createHeaderPart(wordMLPackage, mp,
			factory, false, "3");
	relationship = t.createTextHeaderPart(wordMLPackage, mp, factory,
			"我是页眉,独乐乐不如众乐乐", true, "3", JcEnumeration.CENTER);
	t.addParagraphTest(wordMLPackage, mp, factory);
	t.addPageBreak(wordMLPackage, factory, STBrType.PAGE);
	t.createHeaderReference(wordMLPackage, mp, factory, relationship);
	t.createNormalTableTest(wordMLPackage, mp, factory);
	t.addPageBreak(wordMLPackage, factory, STBrType.TEXT_WRAPPING);
	t.createTableTest(wordMLPackage, mp, factory);
	t.addPageBreak(wordMLPackage, factory, STBrType.TEXT_WRAPPING);
	P paragraph=factory.createP();
	CTBorder topBorder=new CTBorder() ;
	topBorder.setSpace(new BigInteger("1"));
	topBorder.setSz(new BigInteger("2"));
	topBorder.setVal(STBorder.WAVE);
	t.createParagraghLine(wordMLPackage, mp, factory, paragraph, topBorder, topBorder, topBorder, topBorder);
	mp.addObject(paragraph);
	t.createHyperlink(wordMLPackage, mp, factory,paragraph,
			"mailto:[email protected]?subject=docx4j测试", "联系我","微软雅黑","24",JcEnumeration.CENTER);
	
	// 页脚
	// relationship = t.createFooterPart(wordMLPackage, mp, factory,
	// false,"3");
	// relationship = t.createTextFooterPart(wordMLPackage, mp,
	// factory,"我是页脚", true, "3", JcEnumeration.CENTER);
	relationship = t.createFooterPageNumPart(wordMLPackage, mp, factory,
			false, "3", JcEnumeration.CENTER);
	t.createFooterReference(wordMLPackage, mp, factory, relationship);
	t.saveWordPackage(wordMLPackage, new File(
			"f:/saveFile/temp/s7_simple.docx"));
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:40,代码来源:Docx4J_例子2.java

示例14: createTableTest

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public void createTableTest(WordprocessingMLPackage wordMLPackage,
		MainDocumentPart t, ObjectFactory factory) throws Exception {
	RPr titleRpr = getRPr(factory, "宋体", "000000", "22", STHint.EAST_ASIA,
			true, false, false, false);
	RPr contentRpr = getRPr(factory, "宋体", "000000", "22",
			STHint.EAST_ASIA, false, false, false, false);
	Tbl table = factory.createTbl();
	addBorders(table, "2");

	double[] colWidthPercent = new double[] { 15, 20, 20, 20, 25 };// 百分比
	setTableGridCol(wordMLPackage, factory, table, 100, colWidthPercent);
	List<String> columnList = new ArrayList<String>();
	columnList.add("序号");
	columnList.add("姓名信息|姓甚|名谁");
	columnList.add("名刺信息|籍贯|营生");
	addTableTitleCell(factory, wordMLPackage, table, columnList, titleRpr,
			JcEnumeration.CENTER, true, "C6D9F1");

	for (int i = 0; i < 10; i++) {
		Tr contentRow = factory.createTr();
		addTableCell(factory, wordMLPackage, contentRow, i + "",
				contentRpr, JcEnumeration.CENTER, false, null);
		addTableCell(factory, wordMLPackage, contentRow, "无名氏", contentRpr,
				JcEnumeration.CENTER, false, null);
		addTableCell(factory, wordMLPackage, contentRow, "佚名", contentRpr,
				JcEnumeration.CENTER, false, null);
		addTableCell(factory, wordMLPackage, contentRow, "武林", contentRpr,
				JcEnumeration.CENTER, false, null);
		addTableCell(factory, wordMLPackage, contentRow, "吟诗赋曲",
				contentRpr, JcEnumeration.CENTER, false, null);
		table.getContent().add(contentRow);
	}
	setTableAlign(factory, table, JcEnumeration.CENTER);
	t.addObject(table);
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:36,代码来源:Docx4J_例子2.java

示例15: createTextHeaderPart

import org.docx4j.wml.JcEnumeration; //导入依赖的package包/类
public Relationship createTextHeaderPart(
		WordprocessingMLPackage wordprocessingMLPackage,
		MainDocumentPart t, ObjectFactory factory, String content,
		boolean isUnderLine, String underLineSz, JcEnumeration jcEnumeration)
		throws Exception {
	HeaderPart headerPart = new HeaderPart();
	Relationship rel = t.addTargetPart(headerPart);
	headerPart.setJaxbElement(getTextHdr(wordprocessingMLPackage, factory,
			headerPart, content, isUnderLine, underLineSz, jcEnumeration));
	return rel;
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:12,代码来源:Docx4J_例子2.java


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