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


Java XmlUtils.deepCopy方法代码示例

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


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

示例1: repeatRows

import org.docx4j.XmlUtils; //导入方法依赖的package包/类
private void repeatRows(final WordprocessingMLPackage document) {
    for (TableRowCoordinates rCoords : tableRowsToRepeat.keySet()) {
        List<Object> expressionContexts = tableRowsToRepeat.get(rCoords);
        for (final Object expressionContext : expressionContexts) {
            Tr rowClone = XmlUtils.deepCopy(rCoords.getRow());
            DocumentWalker walker = new BaseDocumentWalker(rowClone) {
                @Override
                protected void onParagraph(P paragraph) {
                    placeholderReplacer.resolveExpressionsForParagraph(paragraph, expressionContext, document);
                }
            };
            walker.walk();
            rCoords.getParentTableCoordinates().getTable().getContent().add(rowClone);
        }
        rCoords.getParentTableCoordinates().getTable().getContent().remove(rCoords.getRow());
        // TODO: remove "repeatTableRow"-comment from cloned rows!
    }
}
 
开发者ID:thombergs,项目名称:docx-stamper,代码行数:19,代码来源:RepeatProcessor.java

示例2: copyRowSettings

import org.docx4j.XmlUtils; //导入方法依赖的package包/类
protected void copyRowSettings(Row templateRow, Row newRow, Worksheet templateWorksheet, Worksheet resultWorksheet) {
    newRow.setHt(templateRow.getHt());
    newRow.setCustomHeight(true);
    CTPageBreak rowBreaks = templateWorksheet.getRowBreaks();
    if (rowBreaks != null && rowBreaks.getBrk() != null) {
        CTPageBreak resultWorksheetRowBreaks = resultWorksheet.getRowBreaks();
        for (CTBreak templateBreak : rowBreaks.getBrk()) {
            if (templateRow.getR().equals(templateBreak.getId())) {
                CTBreak newBreak = XmlUtils.deepCopy(templateBreak, Context.jcSML);
                newBreak.setId(newRow.getR());
                resultWorksheetRowBreaks.getBrk().add(newBreak);
            }
        }

        long rowBreaksCount = resultWorksheetRowBreaks.getBrk().size();
        resultWorksheetRowBreaks.setCount(rowBreaksCount);
        resultWorksheetRowBreaks.setManualBreakCount(rowBreaksCount);
    }

    newRow.setOutlineLevel(templateRow.getOutlineLevel());
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:22,代码来源:XlsxFormatter.java

示例3: addRowToTable

import org.docx4j.XmlUtils; //导入方法依赖的package包/类
public static void addRowToTable(Tbl reviewtable, Tr templateRow, Map<String, String> replacements) {  
    Tr workingRow = (Tr) XmlUtils.deepCopy(templateRow);  
    List<?> textElements = getTargetElements(workingRow, Text.class);  
    for (Object object : textElements) {  
        Text text = (Text) object;  
        String replacementValue = (String) replacements.get(text.getValue());  
        if (replacementValue != null)  
            text.setValue(replacementValue);  
    }  
  
    reviewtable.getContent().add(workingRow);  
}
 
开发者ID:vindell,项目名称:docx4j-template,代码行数:13,代码来源:WMLPackageUtils.java

示例4: copyRow

import org.docx4j.XmlUtils; //导入方法依赖的package包/类
public Tr copyRow(Tr row) {
    Tr copiedRow = XmlUtils.deepCopy(row);
    new TraversalUtil(copiedRow, INVARIANTS_SETTER);//set parent for each sub-element of copied row (otherwise parent would be JaxbElement)
    int index = table.getContent().indexOf(row);
    table.getContent().add(index, copiedRow);
    return copiedRow;
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:8,代码来源:TableManager.java

示例5: copyCells

import org.docx4j.XmlUtils; //导入方法依赖的package包/类
protected List<Cell> copyCells(Range templateRange, BandData bandData, Row newRow, List<Cell> templateCells) {
    List<Cell> resultCells = new ArrayList<>();

    Worksheet resultWorksheet = getWorksheet(newRow);
    for (Cell templateCell : templateCells) {
        checkThreadInterrupted();
        Cell newCell = copyCell(templateCell);

        if (newCell.getF() != null) {
            addFormulaForPostProcessing(templateRange, bandData, newRow, templateCell, newCell);
        }

        resultCells.add(newCell);

        CellReference tempRef = new CellReference(templateRange.getSheet(), templateCell);
        CellReference newRef = new CellReference(templateRange.getSheet(), newCell.getR());
        newRef.move(newRow.getR().intValue(), newRef.getColumn());

        //if we have vertical band or horizontal band right after vertical band - it should be shifted
        //only if there is vertical intersection with vertical band?
        newRef.shift(0, previousRangesRightOffset);

        newCell.setR(newRef.toReference());

        newRow.getC().add(newCell);
        newCell.setParent(newRow);

        WorksheetPart worksheetPart = null;
        for (Document.SheetWrapper sheetWrapper : result.getWorksheets()) {
            if (sheetWrapper.getWorksheet().getJaxbElement() == resultWorksheet) {
                worksheetPart = sheetWrapper.getWorksheet();
            }
        }

        updateCell(worksheetPart, bandData, newCell);

        Col templateColumn = template.getColumnForCell(templateRange.getSheet(), tempRef);
        Col resultColumn = result.getColumnForCell(templateRange.getSheet(), newRef);

        if (templateColumn != null && resultColumn == null) {
            resultColumn = XmlUtils.deepCopy(templateColumn, Context.jcSML);
            resultColumn.setMin(newRef.getColumn());
            resultColumn.setMax(newRef.getColumn());
            resultColumn.setOutlineLevel(templateColumn.getOutlineLevel());

            resultWorksheet.getCols().get(0).getCol().add(resultColumn);
        }

        hintProcessor.add(tempRef, templateCell, newCell, bandData);

    }
    return resultCells;
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:54,代码来源:XlsxFormatter.java


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