Package org.jfree.xmlns.writer

Examples of org.jfree.xmlns.writer.XmlWriter


        else
        {
            breakDefinition = null;
        }

        final XmlWriter xmlWriter = getXmlWriter();
        if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED &&
                masterPageName != null)
        {
            // close the last table-tag, we will open a new one
            xmlWriter.writeCloseTag();
            // Reset the detail-state to 'started' so that the table's columns get printed now.
            detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED;
        }

        if (tableLayoutConfig == TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null)
        {
            if (masterPageName != null)
            {
                // write a paragraph that uses the VARIABLES_HIDDEN_STYLE as
                // primary style. Derive that one and add the manual pagebreak.
                // The predefined style already has the 'keep-together' flags set.
//        Log.debug("Variables-Section with new Master-Page " + variables + " " + masterPageName);

                final OfficeStyle style = deriveStyle(OfficeToken.PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT);
                style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
                if (breakDefinition.isResetPageNumber())
                {
                    final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES);
                    paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");
                }
                if (isColumnBreakPending())
                {
                    final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES);
                    paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column");
                    setColumnBreakPending(false);
                }
                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN);

                masterPageName = null;
            //breakDefinition = null;
            }
            else if (isColumnBreakPending())
            {
                setColumnBreakPending(false);

                final OfficeStyle style = deriveStyle(OfficeToken.PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT);
                final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES);
                paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");

                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN);
            }
            else
            {
                // Write a paragraph without adding the pagebreak. We can reuse the global style, but we have to make
                // sure that the style is part of the current 'auto-style' collection.
//        Log.debug("Variables-Section " + variables);

                StyleUtilities.copyStyle(OfficeToken.PARAGRAPH,
                        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(),
                        getGlobalStylesCollection(), getPredefinedStylesCollection());
                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME,
                        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN);
            }
            xmlWriter.writeText(variables);
            xmlWriter.writeCloseTag();
            variables = null;
        }

        final boolean keepWithNext = isKeepTableWithNext();
        final boolean localKeepTogether = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER));
        final boolean tableMergeActive = isTableMergeActive();
        if (tableMergeActive)
        {
            this.sectionKeepTogether = localKeepTogether;
        }
        else
        {
            this.sectionKeepTogether = false;

        }

        // Check, whether we have a reason to derive a style...
        if (masterPageName != null ||
                (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending())
        {
            final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
            final OfficeStyle style = deriveStyle("table", styleName);

            if (masterPageName != null)
            {
//        Log.debug("Starting a new MasterPage: " + masterPageName);
                // Patch the current styles.
                // This usually only happens on Table-Styles or Paragraph-Styles
                style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
                if (breakDefinition.isResetPageNumber())
                {
                    final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES);
                    paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1");
                }
            }
            if (isColumnBreakPending())
            {
                final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES);
                paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column");
                setColumnBreakPending(false);
            }

            // Inhibit breaks inside the table only if it has been defined and if we do not create one single
            // big detail section. In that case, this flag would be invalid and would cause layout-errors.
            if (!tableMergeActive)
            {
                if (localKeepTogether)
                {
                    final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                    tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE);
                }
            }
            else
            {
                if (detailBandProcessingState == DETAIL_SECTION_WAIT)
                {
                    detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED;
                }
                else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED)
                {
                    detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED;
                }
            }
            if (keepWithNext)
            {
                boolean addKeepWithNext = true;
                if (currentRole == ROLE_GROUP_FOOTER)
                {
                    addKeepWithNext = isParentKeepTogether();
                }

                final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE);
                if (addKeepWithNext)
                {
                    tableProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS);
                    // A keep-with-next does not work, if the may-break-betweek rows is not set to false ..
                }
            }
            attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
        // no need to copy the styles, this was done while deriving the
        // style ..
        }
        else
        {
            // Check, whether we may be able to skip the table.
            if (tableMergeActive)
            {
                if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED)
                {
                    // Skip the whole thing ..
                    return;
                }
                else if (detailBandProcessingState == DETAIL_SECTION_WAIT)
                {
                    if (keepWithNext)
                    {
                        final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);

                        final OfficeStyle style = deriveStyle(OfficeToken.TABLE, styleName);
                        final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES);
                        // A keep-with-next does not work, if the may-break-betweek rows is not set to false ..
                        tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE);
                        final String hasGroupFooter = (String) attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, "has-group-footer");
                        if (hasGroupFooter != null && hasGroupFooter.equals(OfficeToken.TRUE))
                        {
                            tableProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS);
                        }

                        attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
                    }
                    detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED;
                }
                else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED)
                {
                    detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED;
                }
            }

            // process the styles as usual
            performStyleProcessing(attrs);
        }

        final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
        final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
        final AttributeList attrList = buildAttributeList(attrs);
        xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN);
    }
View Full Code Here


            rootAttributes.addNamespaceDeclaration("office", OfficeNamespaces.OFFICE_NS);
            rootAttributes.addNamespaceDeclaration("config", OfficeNamespaces.CONFIG);
            rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS);
            rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0");
            final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml", "text/xml");
            final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), createTagDescription());
            xmlWriter.setAlwaysAddNamespace(true);
            xmlWriter.writeXmlDeclaration("UTF-8");
            xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-settings", rootAttributes, XmlWriterSupport.OPEN);
            xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "settings", XmlWriterSupport.OPEN);
            xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item-set", NAME, "ooo:configuration-settings", XmlWriterSupport.OPEN);

            final AttributeList configAttributes = new AttributeList();
            configAttributes.setAttribute(OfficeNamespaces.CONFIG, NAME, "TableRowKeep");
            configAttributes.setAttribute(OfficeNamespaces.CONFIG, "type", "boolean");
            xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item", configAttributes, XmlWriterSupport.OPEN);
            xmlWriter.writeText(OfficeToken.TRUE);
            xmlWriter.writeCloseTag();

            xmlWriter.writeCloseTag();
            xmlWriter.writeCloseTag();
            xmlWriter.writeCloseTag();
            xmlWriter.close();

      // now copy the meta.xml
      if (getInputRepository().isReadable("meta.xml"))
            {
                final InputStream inputStream = getInputRepository().createInputStream("meta.xml");
View Full Code Here

                ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType)))
        {
            return;
        }

        final XmlWriter xmlWriter = getXmlWriter();
        if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH &&
                isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType))
        {
            if (variables != null)
            {
                // This cannot happen as long as the report sections only contain tables. But at some point in the
                // future they will be made of paragraphs, and then we are prepared ..
                //Log.debug("Variables-Section " + variables);
                final String tag;
                if (sectionKeepTogether && expectedTableRowCount > 0)
                {
                    tag = TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT;
                }
                else
                {
                    tag = TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT;
                }
                StyleUtilities.copyStyle(OfficeToken.PARAGRAPH,
                        tag, getStylesCollection(),
                        getGlobalStylesCollection(), getPredefinedStylesCollection());
                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME,
                        tag, XmlWriterSupport.OPEN);
                xmlWriter.writeText(variables);
                xmlWriter.writeCloseTag();
                variables = null;
            }
        /**
        // Only generate the empty paragraph, if we have to add the keep-together ..
        else if (cellEmpty && expectedTableRowCount > 0 &&
        sectionKeepTogether && !firstCellSeen)
        {
        // we have no variables ..
        StyleUtilities.copyStyle(OfficeToken.PARAGRAPH,
        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(),
        getGlobalStylesCollection(), getPredefinedStylesCollection());
        xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME,
        TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE);
        }
         */
        }

        if (isTableNs && (ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) || ObjectUtilities.equal(OfficeToken.COVERED_TABLE_CELL, elementType)))
        {
            firstCellSeen = true;
        }
        if (isTableNs && ObjectUtilities.equal(OfficeToken.TABLE, elementType))
        {
            if (getCurrentRole() == ROLE_DETAIL)
            {
                if (!isTableMergeActive())
                {
                    // We do not merge the detail bands, so an ordinary close will do.
                    xmlWriter.writeCloseTag();
                }
                else if (detailBandProcessingState == DETAIL_SECTION_FIRST_STARTED)
                {
                    final int keepTogetherState = getCurrentContext().getKeepTogether();
                    if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL)
                    {
                        xmlWriter.writeCloseTag();
                        detailBandProcessingState = DETAIL_SECTION_FIRST_PRINTED;
                    }
                    else
                    {
                        detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED;
                    }
                }
                else if (detailBandProcessingState == DETAIL_SECTION_OTHER_STARTED)
                {
                    detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED;
                }
            }
            else
            {
                xmlWriter.writeCloseTag();
            }
            if (isSectionPagebreakAfter(attrs))
            {
                setPagebreakDefinition(new PageBreakDefinition(false));
            }
        }
        else
        {
            xmlWriter.writeCloseTag();
        }
    }
View Full Code Here

            throws IOException, DataSourceException, ReportProcessingException
    {
        if (tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED)
        {
            // closes the table ..
            final XmlWriter xmlWriter = getXmlWriter();
            xmlWriter.writeCloseTag();
            detailBandProcessingState = DETAIL_SECTION_WAIT;
        }

    }
View Full Code Here

    protected void endContent(final AttributeMap attrs)
            throws IOException, DataSourceException, ReportProcessingException
    {
        finishSection();
        final BufferState bodyText = finishBuffering();
        final XmlWriter writer = getXmlWriter();

        final Map definedMappings = variablesDeclarations.getDefinedMappings();
        if (!definedMappings.isEmpty())
        {
            writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decls", XmlWriterSupport.OPEN);
            final Iterator mappingsIt = definedMappings.entrySet().iterator();
            while (mappingsIt.hasNext())
            {
                final Map.Entry entry = (Map.Entry) mappingsIt.next();
                final AttributeList entryList = new AttributeList();
                entryList.setAttribute(OfficeNamespaces.TEXT_NS, NAME, (String) entry.getKey());
                entryList.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, (String) entry.getValue());
                writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decl", entryList, XmlWriterSupport.CLOSE);
            }
            writer.writeCloseTag();
        }

        writer.writeStream(bodyText.getXmlAsReader());
        writer.setLineEmpty(true);
        writer.writeCloseTag();
    }
View Full Code Here

    {
        if (paragraphFound)
        {
            try
            {
                final XmlWriter xmlWriter = getXmlWriter();
                xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, null, XmlWriterSupport.OPEN);
                paragraphHandled = true;
                paragraphFound = false;
            }
            catch (IOException ex)
            {
View Full Code Here

    }

    private void processElement(final AttributeMap attrs, final String namespace, final String elementType)
            throws IOException, ReportProcessingException
    {
        final XmlWriter xmlWriter = getXmlWriter();

        if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, attrs))
        {
            // a new table means we must clear our "calculated" table boundary array cache
            boundariesForTableArray = null;

            final String tableStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
            if (tableStyle == null)
            {
                tableBackgroundColor = null;
            }
            else
            {
                final Object raw = StyleUtilities.queryStyle(getPredefinedStylesCollection(), OfficeToken.TABLE, tableStyle,
                        "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
                if (raw == null || "transparent".equals(raw))
                {
                    tableBackgroundColor = null;
                }
                else
                {
                    tableBackgroundColor = String.valueOf(raw);
                }
            }
            return;
        }

        if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) ||
                ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs))
        {
            return;
        }

        // covered-table-cell elements may appear in the input from row or column spans. In the event that we hit a
        // column-span we simply ignore these elements because we are going to adjust the span to fit the uniform table.
        if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, attrs))
        {
            if (columnSpanCounter > 0)
            {
                columnSpanCounter--;
            }

            if (columnSpanCounter == 0)
            {
                // if we weren't expecting a covered-table-cell, let's use it, it's probably from a row-span
                columnCounter++;
                final int span = getColumnSpanForCell(tableCounter, columnCounter, 1);
                // use the calculated span for the column in the uniform table to create any additional covered-table-cell
                // elements
                for (int i = 0; i < span; i++)
                {
                    xmlWriter.writeTag(namespace, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE);
                }
            }
            return;
        }

        if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs))
        {
            // a new row means our column counter gets reset
            columnCounter = 0;
            // Lets make sure the color of the table is ok ..
            if (tableBackgroundColor != null)
            {
                final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
                final OfficeStyle style = deriveStyle(OfficeToken.TABLE_ROW, styleName);
                Element tableRowProperties = style.getTableRowProperties();
                if (tableRowProperties == null)
                {
                    tableRowProperties = new Section();
                    tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS);
                    tableRowProperties.setType("table-row-properties");
                    tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor);
                    style.addNode(tableRowProperties);
                }
                else
                {
                    final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
                    if (oldValue == null || "transparent".equals(oldValue))
                    {
                        tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor);
                    }
                }
                attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
            }
        }
        else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs))
        {
            columnCounter++;
            final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
            if (styleName != null)
            {
                OfficeStyle cellStyle = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_CELL, styleName);
                if (cellStyle != null)
                {
                    final Element props = cellStyle.getTableCellProperties();
                    if (props != null)
                    {
                        final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
                        if (raw == null || "transparent".equals(raw))
                        {
                            cellStyle.removeNode(props);
                        }
                    }
                }
            }

            final String numColSpanStr = (String) attrs.getAttribute(namespace, "number-columns-spanned");
            int initialColumnSpan = columnSpanCounter = 1;
            if (numColSpanStr != null)
            {
                initialColumnSpan = Integer.parseInt(numColSpanStr);
                columnSpanCounter = initialColumnSpan;
            }
            final int span = getColumnSpanForCell(tableCounter, columnCounter, initialColumnSpan);
            if (initialColumnSpan > 1)
            {
                // add the initial column span to our column counter index (subtract 1, since it is counted by default)
                columnCounter += initialColumnSpan - 1;
            }

            // if (span < initialColumnSpan)
            // {
            // // ColumnBoundary cbs[] = getBoundariesForTable(tableCounter);
            // // for (int i = 0; i < cbs.length; i++)
            // // {
            // // System.out.print(cbs[i].getBoundary() + " ");
            // // }
            // // System.out.println();
            //
            // Log.error("A cell cannot span less than the declared columns: Declared=" + initialColumnSpan + " Computed="
            // + span);
            // }

            // there's no point to create number-columns-spanned attributes if we only span 1 column
            if (span > 1)
            {
                attrs.setAttribute(namespace, "number-columns-spanned", "" + span);
            }
        // we must also generate "covered-table-cell" elements for each column spanned
        // but we'll do this in the endElement, after we close this OfficeToken.TABLE_CELL
        }

        // All styles have to be processed or you will loose the paragraph-styles and inline text-styles.
        // ..
        performStyleProcessing(attrs);

        final AttributeList attrList = buildAttributeList(attrs);
        xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN);
    // System.out.println("elementType = " + elementType);
    }
View Full Code Here

    {
        if (!shapes.isEmpty())
        {
            try
            {
                final XmlWriter xmlWriter = getXmlWriter();
                // at this point we need to generate the table-columns section based on our boundary table
                // <table:shapes>
                // <draw:frame />
                // ..
                // </table:shapes>
                xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.SHAPES, null, XmlWriterSupport.OPEN);


                for (int i = 0; i < shapes.size(); i++)
                {
                    final AttributeMap attrs = (AttributeMap) shapes.get(i);
                    final AttributeList attrList = buildAttributeList(attrs);
                    attrList.removeAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME);
                    xmlWriter.writeTag(OfficeNamespaces.DRAWING_NS, OfficeToken.FRAME, attrList, XmlWriterSupport.OPEN);
                    startChartProcessing((AttributeMap) ole.get(i));

                    xmlWriter.writeCloseTag();
                }
                xmlWriter.writeCloseTag();
            }
            catch (IOException e)
            {
                throw new ReportProcessingException("Failed", e);
            }
View Full Code Here

    private void createTableColumns() throws ReportProcessingException
    {
        try
        {
            final XmlWriter xmlWriter = getXmlWriter();
            // at this point we need to generate the table-columns section based on our boundary table
            // <table-columns>
            // <table-column style-name="coX"/>
            // ..
            // </table-columns>
            // the first boundary is '0' which is a placeholder so we will ignore it
            xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, null, XmlWriterSupport.OPEN);

            // blow away current column styles
            // start processing at i=1 because we added a boundary for "0" which is virtual
            final ColumnBoundary[] cba = getSortedColumnBoundaryArray();
            for (int i = 1; i < cba.length; i++)
            {
                final ColumnBoundary cb = cba[i];
                float columnWidth = cb.getBoundary();
                if (i > 1)
                {
                    columnWidth -= cba[i - 1].getBoundary();
                }
                final OfficeStyle style = deriveStyle(OfficeToken.TABLE_COLUMN, ("co" + i + "_"));
                final Section tableColumnProperties = new Section();
                tableColumnProperties.setType("table-column-properties");
                tableColumnProperties.setNamespace(style.getNamespace());
                tableColumnProperties.setAttribute(style.getNamespace(), "column-width", columnWidth + getUnitsOfMeasure(null));
                style.addNode(tableColumnProperties);

                final AttributeList myAttrList = new AttributeList();
                myAttrList.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
                xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, myAttrList, XmlWriterSupport.CLOSE);
            }
            xmlWriter.writeCloseTag();
        }
        catch (IOException e)
        {
            throw new ReportProcessingException("Failed", e);
        }
View Full Code Here

            paragraphHandled = false;
        }
        try
        {
            final XmlWriter xmlWriter = getXmlWriter();
            xmlWriter.writeCloseTag();
            // table-cell elements may have a number-columns-spanned attribute which indicates how many
            // 'covered-table-cell' elements we need to generate
            generateCoveredTableCells(attrs);
        }
        catch (IOException e)
View Full Code Here

TOP

Related Classes of org.jfree.xmlns.writer.XmlWriter

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.