Package com.haulmont.yarg.structure

Examples of com.haulmont.yarg.structure.BandData


        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testDocx() throws Exception {
        BandData root = createRootBand();
        BandData footer = root.getChildByName("Footer");
        BandData footerChild = new BandData("FooterChild", footer);
        footerChild.addData("nestedData", "NESTED_DATA");
        footerChild.addData("nestedData.withPoint", "NESTED_DATA_WITH_POINT");
        footer.addChild(footerChild);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result.docx");
        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("docx", root,
                new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.docx), outputStream));
View Full Code Here


        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testDocxToPdf() throws Exception {
        BandData root = createRootBand();
        BandData footer = root.getChildByName("Footer");
        BandData footerChild = new BandData("FooterChild", footer);
        footerChild.addData("nestedData", "NESTED_DATA");
        footer.addChild(footerChild);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_docx.pdf");
        DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory();
        defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100));
View Full Code Here

        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testDocxToHtml() throws Exception {
        BandData root = createRootBand();
        BandData footer = root.getChildByName("Footer");
        BandData footerChild = new BandData("FooterChild", footer);
        footerChild.addData("nestedData", "NESTED_DATA");
        footer.addChild(footerChild);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_docx.html");
        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("docx", root,
                new ReportTemplateImpl("", "./modules/core/test/smoketest/test.docx", "./modules/core/test/smoketest/test.docx", ReportOutputType.html), outputStream));
View Full Code Here

        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testDocxRunMerge() throws Exception {
        BandData root = new BandData("Root", null, BandOrientation.HORIZONTAL);
        HashMap<String, Object> rootData = new HashMap<String, Object>();
        rootData.put("param1", "AAAAAA");
        root.setData(rootData);
        BandData cover = new BandData("Cover", root, BandOrientation.HORIZONTAL);
        cover.setData(new HashMap<String, Object>());
        cover.addData("index", "123");
        cover.addData("volume", "321");
        cover.addData("name", "AAA");
        BandData documents = new BandData("Documents", root, BandOrientation.HORIZONTAL);
        documents.setData(new HashMap<String, Object>());
        root.addChild(cover);
        root.addChild(documents);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/runMerge.docx");
        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("docx", root,
View Full Code Here

        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testOdt() throws Exception {
        BandData root = createRootBand();
        BandData footer = root.getChildByName("Footer");
        BandData footerChild = new BandData("FooterChild", footer);
        footerChild.addData("nestedData", "NESTED_DATA");
        footer.addChild(footerChild);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result.doc");
        DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory();
        defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100));
View Full Code Here

        IOUtils.closeQuietly(outputStream);
    }

    @Test
    public void testDoc() throws Exception {
        BandData root = createRootBand();
        BandData footer = root.getChildByName("Footer");
        BandData footerChild = new BandData("FooterChild", footer);
        footerChild.addData("nestedData", "NESTED_DATA");
        footer.addChild(footerChild);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result2.doc");
        DefaultFormatterFactory defaultFormatterFactory = new DefaultFormatterFactory();
        defaultFormatterFactory.setOfficeIntegration(new OfficeIntegration(openOfficePath, 8100));
View Full Code Here

        defaultFormatterFactory.setOfficeIntegration(officeIntegrationAPI);
        new Thread() {
            @Override
            public void run() {
                try {
                    BandData root = createRootBand();
                    BandData footer = root.getChildByName("Footer");
                    BandData footerChild = new BandData("FooterChild", footer);
                    footerChild.addData("nestedData", "NESTED_DATA");
                    footer.addChild(footerChild);
                    FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel1.doc");
                    ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root,
                            new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream));
                    formatter.renderDocument();

                    IOUtils.closeQuietly(outputStream);
                } catch (IOException e) {
                    Assert.fail();
                } finally {
                    countDownLatch.countDown();
                }
            }
        }.start();

        new Thread() {
            @Override
            public void run() {
                try {
                    BandData root = createRootBand();
                    BandData footer = root.getChildByName("Footer");
                    BandData footerChild = new BandData("FooterChild", footer);
                    footerChild.addData("nestedData", "NESTED_DATA");
                    footer.addChild(footerChild);

                    FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel2.doc");
                    ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root,
                            new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream));
                    formatter.renderDocument();

                    IOUtils.closeQuietly(outputStream);
                } catch (IOException e) {
                    Assert.fail();
                } finally {
                    countDownLatch.countDown();
                }
            }
        }.start();

        new Thread() {
            @Override
            public void run() {
                try {
                    BandData root = createRootBand();
                    BandData footer = root.getChildByName("Footer");
                    BandData footerChild = new BandData("FooterChild", footer);
                    footerChild.addData("nestedData", "NESTED_DATA");
                    footer.addChild(footerChild);

                    FileOutputStream outputStream = new FileOutputStream("./result/smoke/result_parallel3.doc");
                    ReportFormatter formatter = defaultFormatterFactory.createFormatter(new FormatterFactoryInput("doc", root,
                            new ReportTemplateImpl("", "./modules/core/test/smoketest/test.doc", "./modules/core/test/smoketest/test.doc", ReportOutputType.doc), outputStream));
View Full Code Here

    }


    @Test
    public void testXlsx() throws Exception {
        BandData root = createRootBand();

        BandData band3_1 = new BandData("Band3", root, BandOrientation.VERTICAL);
        band3_1.addData("col1", 123);
        band3_1.addData("col2", 321);
        BandData band3_2 = new BandData("Band3", root, BandOrientation.VERTICAL);
        band3_2.addData("col1", 456);
        band3_2.addData("col2", 654);
        BandData band3_3 = new BandData("Band3", root, BandOrientation.VERTICAL);
        band3_3.addData("col1", 789);
        band3_3.addData("col2", 987);
        BandData second = new BandData("Second", root, BandOrientation.HORIZONTAL);


        root.addChild(band3_1);
        root.addChild(band3_2);
        root.addChild(band3_3);
        root.addChild(second);

        BandData split = new BandData("Split", root, BandOrientation.HORIZONTAL);
        split.setData(new HashMap<String, Object>());
        split.addData("image", FileUtils.readFileToByteArray(new File("./modules/core/test/yarg.png")));
        root.addChild(split);

        FileOutputStream outputStream = new FileOutputStream("./result/smoke/result.xlsx");
        ReportFormatter formatter = new DefaultFormatterFactory().createFormatter(new FormatterFactoryInput("xlsx", root,
                new ReportTemplateImpl("", "./modules/core/test/smoketest/test.xlsx", "./modules/core/test/smoketest/test.xlsx", ReportOutputType.xlsx), outputStream));
View Full Code Here

            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);
                    parentBand = formulaCellBand.getParentBand();
                }
            }

            for (Range templateRange : rangeDependencies.keySet()) {
                if (templateRange.contains(formulaRange)) {
                    List<Range> resultRanges = new ArrayList<Range>(rangeDependencies.get(templateRange));
                    for (Iterator<Range> iterator = resultRanges.iterator(); iterator.hasNext(); ) {
                        Range resultRange = iterator.next();
                        BandData bandData = bandsToResultRanges.inverse().get(resultRange);
                        if (!bandData.getParentBand().equals(parentBand)) {
                            iterator.remove();
                        }
                    }

                    if (resultRanges.size() > 0) {
View Full Code Here

        List<Range> alreadyRenderedRanges = findAlreadyRenderedRanges(band);

        if (CollectionUtils.isNotEmpty(alreadyRenderedRanges)) {//this band has been already rendered at least once
            Range lastRenderedRange = alreadyRenderedRanges.get(alreadyRenderedRanges.size() - 1);
            BandData lastRenderedBand = bandsToResultRanges.inverse().get(lastRenderedRange);
            LastRowBandVisitor bandVisitor = new LastRowBandVisitor();
            lastRenderedBand.visit(bandVisitor);

            if (resultSheetRows.size() > bandVisitor.lastRow) {//get next row
                firstRow = resultSheetRows.get(bandVisitor.lastRow);
            }
        } else if (!isFirstLevelBand) {
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.structure.BandData

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.