WriteDefinition() public méthode

public WriteDefinition ( Stream result ) : void
result Stream
Résultat void
Exemple #1
0
        /// <summary>
        /// Writes the row definition/settings.
        /// </summary>
        /// <param name="result">The  Stream  to write the definitions to.</param>
        private void writeRowDefinition(Stream result)
        {
            byte[] t;
            result.Write(_rowBegin, 0, _rowBegin.Length);
            Document.OutputDebugLinebreak(result);
            result.Write(_rowWidthStyle, 0, _rowWidthStyle.Length);
            result.Write(_rowWidth, 0, _rowWidth.Length);
            result.Write(t = IntToByteArray(_width), 0, t.Length);
            if (_parentTable.GetCellsFitToPage())
            {
                result.Write(_rowKeepTogether, 0, _rowKeepTogether.Length);
            }
            if (_rowNumber <= _parentTable.GetHeaderRows())
            {
                result.Write(_rowHeaderRow, 0, _rowHeaderRow.Length);
            }
            switch (_parentTable.GetAlignment())
            {
            case Element.ALIGN_LEFT:
                result.Write(_rowAlignLeft, 0, _rowAlignLeft.Length);
                break;

            case Element.ALIGN_RIGHT:
                result.Write(_rowAlignRight, 0, _rowAlignRight.Length);
                break;

            case Element.ALIGN_CENTER:
                result.Write(_rowAlignCenter, 0, _rowAlignCenter.Length);
                break;

            case Element.ALIGN_JUSTIFIED:
            case Element.ALIGN_JUSTIFIED_ALL:
                result.Write(_rowAlignJustified, 0, _rowAlignJustified.Length);
                break;
            }
            result.Write(_rowGraph, 0, _rowGraph.Length);

            RtfBorderGroup borders = _parentTable.GetBorders();

            if (borders != null)
            {
                borders.WriteContent(result);
            }

            if (_parentTable.GetCellSpacing() > 0)
            {
                result.Write(_rowCellSpacingLeft, 0, _rowCellSpacingLeft.Length);
                result.Write(t = IntToByteArray((int)(_parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(_rowCellSpacingLeftStyle, 0, _rowCellSpacingLeftStyle.Length);
                result.Write(_rowCellSpacingTop, 0, _rowCellSpacingTop.Length);
                result.Write(t = IntToByteArray((int)(_parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(_rowCellSpacingTopStyle, 0, _rowCellSpacingTopStyle.Length);
                result.Write(_rowCellSpacingRight, 0, _rowCellSpacingRight.Length);
                result.Write(t = IntToByteArray((int)(_parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(_rowCellSpacingRightStyle, 0, _rowCellSpacingRightStyle.Length);
                result.Write(_rowCellSpacingBottom, 0, _rowCellSpacingBottom.Length);
                result.Write(t = IntToByteArray((int)(_parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(_rowCellSpacingBottomStyle, 0, _rowCellSpacingBottomStyle.Length);
            }

            result.Write(_rowCellPaddingLeft, 0, _rowCellPaddingLeft.Length);
            result.Write(t = IntToByteArray((int)(_parentTable.GetCellPadding() / 2)), 0, t.Length);
            result.Write(_rowCellPaddingRight, 0, _rowCellPaddingRight.Length);
            result.Write(t = IntToByteArray((int)(_parentTable.GetCellPadding() / 2)), 0, t.Length);
            result.Write(_rowCellPaddingLeftStyle, 0, _rowCellPaddingLeftStyle.Length);
            result.Write(_rowCellPaddingRightStyle, 0, _rowCellPaddingRightStyle.Length);

            Document.OutputDebugLinebreak(result);

            for (int i = 0; i < _cells.Count; i++)
            {
                RtfCell rtfCell = (RtfCell)_cells[i];
                rtfCell.WriteDefinition(result);
            }
        }
Exemple #2
0
        /**
         * Writes the row definition/settings.
         *
         * @param result The <code>Stream</code> to write the definitions to.
         */
        private void WriteRowDefinition(Stream result)
        {
            byte[] t;
            result.Write(ROW_BEGIN, 0, ROW_BEGIN.Length);
            this.document.OutputDebugLinebreak(result);
            result.Write(ROW_WIDTH_STYLE, 0, ROW_WIDTH_STYLE.Length);
            result.Write(ROW_WIDTH, 0, ROW_WIDTH.Length);
            result.Write(t = IntToByteArray(this.width), 0, t.Length);
            if (this.parentTable.GetCellsFitToPage())
            {
                result.Write(ROW_KEEP_TOGETHER, 0, ROW_KEEP_TOGETHER.Length);
            }
            if (this.rowNumber <= this.parentTable.GetHeaderRows())
            {
                result.Write(ROW_HEADER_ROW, 0, ROW_HEADER_ROW.Length);
            }
            switch (this.parentTable.GetAlignment())
            {
            case Element.ALIGN_LEFT:
                result.Write(ROW_ALIGN_LEFT, 0, ROW_ALIGN_LEFT.Length);
                break;

            case Element.ALIGN_RIGHT:
                result.Write(ROW_ALIGN_RIGHT, 0, ROW_ALIGN_RIGHT.Length);
                break;

            case Element.ALIGN_CENTER:
                result.Write(ROW_ALIGN_CENTER, 0, ROW_ALIGN_CENTER.Length);
                break;

            case Element.ALIGN_JUSTIFIED:
            case Element.ALIGN_JUSTIFIED_ALL:
                result.Write(ROW_ALIGN_JUSTIFIED, 0, ROW_ALIGN_JUSTIFIED.Length);
                break;
            }
            result.Write(ROW_GRAPH, 0, ROW_GRAPH.Length);

            RtfBorderGroup borders = this.parentTable.GetBorders();

            if (borders != null)
            {
                borders.WriteContent(result);
            }

            if (this.parentTable.GetCellSpacing() > 0)
            {
                result.Write(ROW_CELL_SPACING_LEFT, 0, ROW_CELL_SPACING_LEFT.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(ROW_CELL_SPACING_LEFT_STYLE, 0, ROW_CELL_SPACING_LEFT_STYLE.Length);
                result.Write(ROW_CELL_SPACING_TOP, 0, ROW_CELL_SPACING_TOP.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(ROW_CELL_SPACING_TOP_STYLE, 0, ROW_CELL_SPACING_TOP_STYLE.Length);
                result.Write(ROW_CELL_SPACING_RIGHT, 0, ROW_CELL_SPACING_RIGHT.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(ROW_CELL_SPACING_RIGHT_STYLE, 0, ROW_CELL_SPACING_RIGHT_STYLE.Length);
                result.Write(ROW_CELL_SPACING_BOTTOM, 0, ROW_CELL_SPACING_BOTTOM.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                result.Write(ROW_CELL_SPACING_BOTTOM_STYLE, 0, ROW_CELL_SPACING_BOTTOM_STYLE.Length);
            }

            result.Write(ROW_CELL_PADDING_LEFT, 0, ROW_CELL_PADDING_LEFT.Length);
            result.Write(t = IntToByteArray((int)(this.parentTable.GetCellPadding() / 2)), 0, t.Length);
            result.Write(ROW_CELL_PADDING_RIGHT, 0, ROW_CELL_PADDING_RIGHT.Length);
            result.Write(t = IntToByteArray((int)(this.parentTable.GetCellPadding() / 2)), 0, t.Length);
            result.Write(ROW_CELL_PADDING_LEFT_STYLE, 0, ROW_CELL_PADDING_LEFT_STYLE.Length);
            result.Write(ROW_CELL_PADDING_RIGHT_STYLE, 0, ROW_CELL_PADDING_RIGHT_STYLE.Length);

            this.document.OutputDebugLinebreak(result);

            for (int i = 0; i < this.cells.Count; i++)
            {
                RtfCell rtfCell = (RtfCell)this.cells[i];
                rtfCell.WriteDefinition(result);
            }
        }
Exemple #3
0
        /**
         * Writes the row definition/settings.
         *
         * @return A byte array with the row definitions/settings.
         */
        private byte[] WriteRowDefinitions()
        {
            MemoryStream result = new MemoryStream();

            byte[] t;
            try {
                result.Write(ROW_BEGIN, 0, ROW_BEGIN.Length);
                result.WriteByte((byte)'\n');
                result.Write(ROW_WIDTH_STYLE, 0, ROW_WIDTH_STYLE.Length);
                result.Write(ROW_WIDTH, 0, ROW_WIDTH.Length);
                result.Write(t = IntToByteArray(this.width), 0, t.Length);
                if (this.parentTable.GetCellsFitToPage())
                {
                    result.Write(ROW_KEEP_TOGETHER, 0, ROW_KEEP_TOGETHER.Length);
                }
                if (this.rowNumber <= this.parentTable.GetHeaderRows())
                {
                    result.Write(ROW_HEADER_ROW, 0, ROW_HEADER_ROW.Length);
                }
                switch (this.parentTable.GetAlignment())
                {
                case Element.ALIGN_LEFT:
                    result.Write(ROW_ALIGN_LEFT, 0, ROW_ALIGN_LEFT.Length);
                    break;

                case Element.ALIGN_RIGHT:
                    result.Write(ROW_ALIGN_RIGHT, 0, ROW_ALIGN_RIGHT.Length);
                    break;

                case Element.ALIGN_CENTER:
                    result.Write(ROW_ALIGN_CENTER, 0, ROW_ALIGN_CENTER.Length);
                    break;

                case Element.ALIGN_JUSTIFIED:
                case Element.ALIGN_JUSTIFIED_ALL:
                    result.Write(ROW_ALIGN_JUSTIFIED, 0, ROW_ALIGN_JUSTIFIED.Length);
                    break;
                }
                result.Write(ROW_GRAPH, 0, ROW_GRAPH.Length);

                result.Write(t = this.parentTable.GetBorders().Write(), 0, t.Length);

                if (this.parentTable.GetCellSpacing() > 0)
                {
                    result.Write(ROW_CELL_SPACING_LEFT, 0, ROW_CELL_SPACING_LEFT.Length);
                    result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                    result.Write(ROW_CELL_SPACING_LEFT_STYLE, 0, ROW_CELL_SPACING_LEFT_STYLE.Length);
                    result.Write(ROW_CELL_SPACING_TOP, 0, ROW_CELL_SPACING_TOP.Length);
                    result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                    result.Write(ROW_CELL_SPACING_TOP_STYLE, 0, ROW_CELL_SPACING_TOP_STYLE.Length);
                    result.Write(ROW_CELL_SPACING_RIGHT, 0, ROW_CELL_SPACING_RIGHT.Length);
                    result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                    result.Write(ROW_CELL_SPACING_RIGHT_STYLE, 0, ROW_CELL_SPACING_RIGHT_STYLE.Length);
                    result.Write(ROW_CELL_SPACING_BOTTOM, 0, ROW_CELL_SPACING_BOTTOM.Length);
                    result.Write(t = IntToByteArray((int)(this.parentTable.GetCellSpacing() / 2)), 0, t.Length);
                    result.Write(ROW_CELL_SPACING_BOTTOM_STYLE, 0, ROW_CELL_SPACING_BOTTOM_STYLE.Length);
                }

                result.Write(ROW_CELL_PADDING_LEFT, 0, ROW_CELL_PADDING_LEFT.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellPadding() / 2)), 0, t.Length);
                result.Write(ROW_CELL_PADDING_RIGHT, 0, ROW_CELL_PADDING_RIGHT.Length);
                result.Write(t = IntToByteArray((int)(this.parentTable.GetCellPadding() / 2)), 0, t.Length);
                result.Write(ROW_CELL_PADDING_LEFT_STYLE, 0, ROW_CELL_PADDING_LEFT_STYLE.Length);
                result.Write(ROW_CELL_PADDING_RIGHT_STYLE, 0, ROW_CELL_PADDING_RIGHT_STYLE.Length);

                result.WriteByte((byte)'\n');

                for (int i = 0; i < this.cells.Count; i++)
                {
                    RtfCell rtfCell = (RtfCell)this.cells[i];
                    result.Write(t = rtfCell.WriteDefinition(), 0, t.Length);
                }
            } catch (IOException) {
            }
            return(result.ToArray());
        }