WriteListBeginning() public méthode

public WriteListBeginning ( Stream result ) : void
result Stream
Résultat void
        /// <summary>
        /// Writes the content of this RtfListItem.
        /// </summary>
        public override void WriteContent(Stream result)
        {
            byte[] t;
            if (ParagraphStyle.GetSpacingBefore() > 0)
            {
                result.Write(RtfParagraphStyle.SpacingBefore, 0, RtfParagraphStyle.SpacingBefore.Length);
                result.Write(t = IntToByteArray(ParagraphStyle.GetSpacingBefore()), 0, t.Length);
            }
            if (ParagraphStyle.GetSpacingAfter() > 0)
            {
                result.Write(RtfParagraphStyle.SpacingAfter, 0, RtfParagraphStyle.SpacingAfter.Length);
                result.Write(t = IntToByteArray(ParagraphStyle.GetSpacingAfter()), 0, t.Length);
            }
            if (ParagraphStyle.GetLineLeading() > 0)
            {
                result.Write(LineSpacing, 0, LineSpacing.Length);
                result.Write(t = IntToByteArray(ParagraphStyle.GetLineLeading()), 0, t.Length);
            }
            for (var i = 0; i < Chunks.Count; i++)
            {
                var rtfElement = (IRtfBasicElement)Chunks[i];
                if (rtfElement is RtfChunk)
                {
                    ((RtfChunk)rtfElement).SetSoftLineBreaks(true);
                }
                else if (rtfElement is RtfList)
                {
                    result.Write(Paragraph, 0, Paragraph.Length);
                    _containsInnerList = true;
                }
                rtfElement.WriteContent(result);
                if (rtfElement is RtfList)
                {
                    switch (_parentList.GetLevelFollowValue())
                    {
                    case RtfListLevel.LIST_LEVEL_FOLLOW_NOTHING:
                        break;

                    case RtfListLevel.LIST_LEVEL_FOLLOW_TAB:
                        _parentList.WriteListBeginning(result);
                        result.Write(RtfList.Tab, 0, RtfList.Tab.Length);
                        break;

                    case RtfListLevel.LIST_LEVEL_FOLLOW_SPACE:
                        _parentList.WriteListBeginning(result);
                        result.Write(t = DocWriter.GetIsoBytes(" "), 0, t.Length);
                        break;
                    }
                }
            }
        }
Exemple #2
0
        /**
         * Writes the content of the RtfList
         * @since 2.1.3
         */
        public override void WriteContent(Stream result)
        {
            if (!this.inTable)
            {
                result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            }

            int itemNr = 0;

            if (items != null)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    RtfElement thisRtfElement = (RtfElement)items[i];
                    //thisRtfElement.WriteContent(result);
                    if (thisRtfElement is RtfListItem)
                    {
                        itemNr++;
                        RtfListItem  rtfElement = (RtfListItem)thisRtfElement;
                        RtfListLevel listLevel  = rtfElement.GetParent();
                        if (listLevel.GetListLevel() == 0)
                        {
                            CorrectIndentation();
                        }

                        if (i == 0)
                        {
                            listLevel.WriteListBeginning(result);
                            WriteListNumbers(result);
                        }

                        WriteListTextBlock(result, itemNr, listLevel);

                        rtfElement.WriteContent(result);

                        if (i < (items.Count - 1) || !this.inTable || listLevel.GetListType() > 0) // TODO Fix no paragraph on last list item in tables
                        {
                            result.Write(RtfParagraph.PARAGRAPH, 0, RtfParagraph.PARAGRAPH.Length);
                        }
                        this.document.OutputDebugLinebreak(result);
                    }
                    else if (thisRtfElement is RtfList)
                    {
                        ((RtfList)thisRtfElement).WriteContent(result);
                        //              ((RtfList)thisRtfElement).WriteListBeginning(result);
                        WriteListNumbers(result);
                        this.document.OutputDebugLinebreak(result);
                    }
                }
            }
            if (!this.inTable)
            {
                result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
                result.Write(RtfParagraph.PARAGRAPH_DEFAULTS, 0, RtfParagraph.PARAGRAPH_DEFAULTS.Length);
            }
        }
        /// <summary>
        /// Writes the content of the RtfList
        /// @since 2.1.3
        /// </summary>
        public override void WriteContent(Stream result)
        {
            if (!InTable)
            {
                result.Write(OpenGroup, 0, OpenGroup.Length);
            }

            int itemNr = 0;

            if (_items != null)
            {
                for (int i = 0; i < _items.Count; i++)
                {
                    RtfElement thisRtfElement = (RtfElement)_items[i];
                    //thisRtfElement.WriteContent(result);
                    if (thisRtfElement is RtfListItem)
                    {
                        itemNr++;
                        RtfListItem  rtfElement = (RtfListItem)thisRtfElement;
                        RtfListLevel listLevel  = rtfElement.GetParent();
                        if (listLevel.GetListLevel() == 0)
                        {
                            CorrectIndentation();
                        }

                        if (i == 0)
                        {
                            listLevel.WriteListBeginning(result);
                            WriteListNumbers(result);
                        }

                        WriteListTextBlock(result, itemNr, listLevel);

                        rtfElement.WriteContent(result);

                        if (i < (_items.Count - 1) || !InTable || listLevel.GetListType() > 0)
                        { // TODO Fix no paragraph on last list item in tables
                            result.Write(RtfParagraph.Paragraph, 0, RtfParagraph.Paragraph.Length);
                        }
                        Document.OutputDebugLinebreak(result);
                    }
                    else if (thisRtfElement is RtfList)
                    {
                        ((RtfList)thisRtfElement).WriteContent(result);
                        //              ((RtfList)thisRtfElement).WriteListBeginning(result);
                        WriteListNumbers(result);
                        Document.OutputDebugLinebreak(result);
                    }
                }
            }
            if (!InTable)
            {
                result.Write(CloseGroup, 0, CloseGroup.Length);
                result.Write(RtfPhrase.ParagraphDefaults, 0, RtfPhrase.ParagraphDefaults.Length);
            }
        }