}         // DoEndDocument

        // ----------------------------------------------------------------------
        private void EndParagraph(IRtfInterpreterContext context)
        {
            RtfTextAlignment finalParagraphAlignment = context.GetSafeCurrentTextFormat().Alignment;

            foreach (IRtfVisual alignedVisual in pendingParagraphContent)
            {
                switch (alignedVisual.Kind)
                {
                case RtfVisualKind.Image:
                    RtfVisualImage image = (RtfVisualImage)alignedVisual;
                    // ReSharper disable RedundantCheckBeforeAssignment
                    if (image.Alignment != finalParagraphAlignment)
                    // ReSharper restore RedundantCheckBeforeAssignment
                    {
                        image.Alignment = finalParagraphAlignment;
                    }
                    break;

                case RtfVisualKind.Text:
                    RtfVisualText text = (RtfVisualText)alignedVisual;
                    if (text.Format.Alignment != finalParagraphAlignment)
                    {
                        IRtfTextFormat correctedFormat       = ((RtfTextFormat)text.Format).DeriveWithAlignment(finalParagraphAlignment);
                        IRtfTextFormat correctedUniqueFormat = context.GetUniqueTextFormatInstance(correctedFormat);
                        text.Format = correctedUniqueFormat;
                    }
                    break;
                }
            }
            pendingParagraphContent.Clear();
        }         // EndParagraph
 // ----------------------------------------------------------------------
 private void EndParagraph( IRtfInterpreterContext context )
 {
     RtfTextAlignment finalParagraphAlignment = context.GetSafeCurrentTextFormat().Alignment;
     foreach ( IRtfVisual alignedVisual in pendingParagraphContent )
     {
         switch ( alignedVisual.Kind )
         {
             case RtfVisualKind.Image:
                 RtfVisualImage image = (RtfVisualImage)alignedVisual;
                 // ReSharper disable RedundantCheckBeforeAssignment
                 if ( image.Alignment != finalParagraphAlignment )
                 // ReSharper restore RedundantCheckBeforeAssignment
                 {
                     image.Alignment = finalParagraphAlignment;
                 }
                 break;
             case RtfVisualKind.Text:
                 RtfVisualText text = (RtfVisualText)alignedVisual;
                 if ( text.Format.Alignment != finalParagraphAlignment )
                 {
                     IRtfTextFormat correctedFormat = ( (RtfTextFormat)text.Format ).DeriveWithAlignment( finalParagraphAlignment );
                     IRtfTextFormat correctedUniqueFormat = context.GetUniqueTextFormatInstance( correctedFormat );
                     text.Format = correctedUniqueFormat;
                 }
                 break;
         }
     }
     pendingParagraphContent.Clear();
 }