Package com.haulmont.yarg.formatters.impl.xlsx

Examples of com.haulmont.yarg.formatters.impl.xlsx.CellReference


            Range originalFormulaRange = formulaRange.copy();
            for (Range templateRange : rangeDependencies.keySet()) {
                if (templateRange.contains(formulaRange)) {
                    List<Range> resultRanges = rangeDependencies.get(templateRange);

                    CellReference cellReference = new CellReference(result.getSheetName(worksheet), cellWithFormula.getR());
                    for (Range resultRange : resultRanges) {
                        if (resultRange.contains(cellReference)) {
                            Offset offset = calculateOffset(templateRange, resultRange);

                            formulaRange = formulaRange.shift(offset.downOffset, offset.rightOffset);
                            updateFormula(cellWithFormula, originalFormulaRange, formulaRange, calculationChain, formulaCount++);
                            break;
                        }
                    }
                }
            }
        }

        for (Cell cellWithFormula : outerFormulas) {
            Row row = (Row) cellWithFormula.getParent();
            Worksheet worksheet = getWorksheet(row);
            Range formulaRange = Range.fromCellFormula(result.getSheetName(worksheet), cellWithFormula);
            Range originalFormulaRange = formulaRange.copy();
            CellReference formulaCellReference = new CellReference(result.getSheetName(worksheet), cellWithFormula.getR());

            BandData parentBand = null;
            for (Range resultRange : rangeDependencies.values()) {
                if (resultRange.contains(formulaCellReference)) {
                    BandData formulaCellBand = bandsToResultRanges.inverse().get(resultRange);
View Full Code Here


                addFormulaForPostProcessing(templateRange, 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 (bandData.getOrientation() == BandOrientation.VERTICAL) {
                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());
                resultWorksheet.getCols().get(0).getCol().add(resultColumn);
            }
        }
        return resultCells;
    }
View Full Code Here

    protected Cell createEmptyCell(Range templateRange, BandData bandData, Row newRow) {
        Cell newCell = Context.getsmlObjectFactory().createCell();
        newRow.getC().add(newCell);
        newCell.setParent(newRow);

        CellReference newRef = new CellReference(templateRange.getSheet(), templateRange.getFirstColumn(), templateRange.getFirstRow());
        newRef.move(newRow.getR().intValue(), newRef.getColumn());
        if (bandData.getOrientation() == BandOrientation.VERTICAL) {
            newRef.shift(0, previousRangesRightOffset);

        }

        newCell.setR(newRef.toReference());
        return newCell;
    }
View Full Code Here

            if (image.isValid()) {
                BinaryPartAbstractImage xlsxImage = null;
                xlsxImage = BinaryPartAbstractImage.createImagePart(pkg, worksheetPart, image.imageContent);
                CTTwoCellAnchor anchor = new CTTwoCellAnchor();
                CTMarker from = new CTMarker();
                CellReference cellReference = new CellReference("", newCell.getR());
                from.setCol(cellReference.getColumn() - 1);
                from.setRow(cellReference.getRow() - 1);
                from.setColOff(0L);
                from.setRowOff(0L);
                CTMarker to = new CTMarker();
                to.setCol(cellReference.getColumn());
                to.setRow(cellReference.getRow());
                to.setColOff(0L);
                to.setRowOff(0L);

                anchor.setFrom(from);
                anchor.setTo(to);
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.formatters.impl.xlsx.CellReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.