コード例 #1
0
        /// <summary>
        /// Write the cell definition part of this RtfCell
        /// </summary>
        /// <returns>A byte array with the cell definition</returns>
        public virtual void WriteDefinition(Stream result)
        {
            byte[] t;
            if (_mergeType == MergeVertParent)
            {
                result.Write(t = DocWriter.GetIsoBytes("\\clvmgf"), 0, t.Length);
            }
            else if (_mergeType == MergeVertChild)
            {
                result.Write(t = DocWriter.GetIsoBytes("\\clvmrg"), 0, t.Length);
            }
            switch (verticalAlignment)
            {
            case ALIGN_BOTTOM:
                result.Write(t = DocWriter.GetIsoBytes("\\clvertalb"), 0, t.Length);
                break;

            case ALIGN_CENTER:
            case ALIGN_MIDDLE:
                result.Write(t = DocWriter.GetIsoBytes("\\clvertalc"), 0, t.Length);
                break;

            case ALIGN_TOP:
                result.Write(t = DocWriter.GetIsoBytes("\\clvertalt"), 0, t.Length);
                break;
            }
            _borders.WriteContent(result);

            if (_backgroundColor != null)
            {
                result.Write(t = DocWriter.GetIsoBytes("\\clcbpat"), 0, t.Length);
                result.Write(t = intToByteArray(_backgroundColor.GetColorNumber()), 0, t.Length);
            }
            _document.OutputDebugLinebreak(result);

            result.Write(t = DocWriter.GetIsoBytes("\\clftsWidth3"), 0, t.Length);
            _document.OutputDebugLinebreak(result);

            result.Write(t = DocWriter.GetIsoBytes("\\clwWidth"), 0, t.Length);
            result.Write(t = intToByteArray(_cellWidth), 0, t.Length);
            _document.OutputDebugLinebreak(result);

            if (_cellPadding > 0)
            {
                result.Write(t = DocWriter.GetIsoBytes("\\clpadl"), 0, t.Length);
                result.Write(t = intToByteArray(_cellPadding / 2), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadt"), 0, t.Length);
                result.Write(t = intToByteArray(_cellPadding / 2), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadr"), 0, t.Length);
                result.Write(t = intToByteArray(_cellPadding / 2), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadb"), 0, t.Length);
                result.Write(t = intToByteArray(_cellPadding / 2), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadfl3"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadft3"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadfr3"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\clpadfb3"), 0, t.Length);
            }
            result.Write(t = DocWriter.GetIsoBytes("\\cellx"), 0, t.Length);
            result.Write(t = intToByteArray(_cellRight), 0, t.Length);
        }