Inheritance: iTextSharp.text.rtf.RtfElement, IRtfExtendedElement
        /**
         * Writes the list and list override tables.
         */
        public virtual void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(LIST_TABLE, 0, LIST_TABLE.Length);
            this.document.OutputDebugLinebreak(result);

            for (int i = 0; i < picturelists.Count; i++)
            {
                RtfPictureList l = (RtfPictureList)picturelists[i];
                //          l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                this.document.OutputDebugLinebreak(result);
            }

            for (int i = 0; i < lists.Count; i++)
            {
                RtfList l = (RtfList)lists[i];
                l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                this.document.OutputDebugLinebreak(result);
            }
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);

            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(LIST_OVERRIDE_TABLE, 0, LIST_OVERRIDE_TABLE.Length);
            this.document.OutputDebugLinebreak(result);

            // list override index values are 1-based, not 0.
            // valid list override index values \ls are 1 to 2000.
            // if there are more then 2000 lists, the result is undefined.
            for (int i = 0; i < lists.Count; i++)
            {
                result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
                result.Write(LIST_OVERRIDE, 0, LIST_OVERRIDE.Length);
                result.Write(RtfList.LIST_ID, 0, RtfList.LIST_ID.Length);
                result.Write(t = IntToByteArray(((RtfList)lists[i]).GetID()), 0, t.Length);
                result.Write(LIST_OVERRIDE_COUNT, 0, LIST_OVERRIDE_COUNT.Length);
                result.Write(t = IntToByteArray(0), 0, t.Length);    // is this correct? Spec says valid values are 1 or 9.
                result.Write(RtfList.LIST_NUMBER, 0, RtfList.LIST_NUMBER.Length);
                result.Write(t = IntToByteArray(((RtfList)lists[i]).GetListNumber()), 0, t.Length);
                result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
                this.document.OutputDebugLinebreak(result);
            }
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);
        }
Beispiel #2
0
        /// <summary>
        /// Writes the list and list override tables.
        /// </summary>
        public virtual void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(_listTable, 0, _listTable.Length);
            Document.OutputDebugLinebreak(result);

            for (int i = 0; i < _picturelists.Count; i++)
            {
                RtfPictureList l = (RtfPictureList)_picturelists[i];
                //          l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                Document.OutputDebugLinebreak(result);
            }

            for (int i = 0; i < _lists.Count; i++)
            {
                RtfList l = (RtfList)_lists[i];
                l.SetId(Document.GetRandomInt());
                l.WriteDefinition(result);
                Document.OutputDebugLinebreak(result);
            }
            result.Write(CloseGroup, 0, CloseGroup.Length);
            Document.OutputDebugLinebreak(result);

            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(_listOverrideTable, 0, _listOverrideTable.Length);
            Document.OutputDebugLinebreak(result);

            // list override index values are 1-based, not 0.
            // valid list override index values \ls are 1 to 2000.
            // if there are more then 2000 lists, the result is undefined.
            for (int i = 0; i < _lists.Count; i++)
            {
                result.Write(OpenGroup, 0, OpenGroup.Length);
                result.Write(_listOverride, 0, _listOverride.Length);
                result.Write(RtfList.ListId, 0, RtfList.ListId.Length);
                result.Write(t = IntToByteArray(((RtfList)_lists[i]).GetId()), 0, t.Length);
                result.Write(_listOverrideCount, 0, _listOverrideCount.Length);
                result.Write(t = IntToByteArray(0), 0, t.Length);    // is this correct? Spec says valid values are 1 or 9.
                result.Write(RtfList.ListNumber, 0, RtfList.ListNumber.Length);
                result.Write(t = IntToByteArray(((RtfList)_lists[i]).GetListNumber()), 0, t.Length);
                result.Write(CloseGroup, 0, CloseGroup.Length);
                Document.OutputDebugLinebreak(result);
            }
            result.Write(CloseGroup, 0, CloseGroup.Length);
            Document.OutputDebugLinebreak(result);
        }