コード例 #1
0
ファイル: DocumentElements.cs プロジェクト: zbjxb/MigraDoc
        /// <summary>
        /// Converts DocumentElements into DDL.
        /// </summary>
        internal override void Serialize(Serializer serializer)
        {
            int count = Count;

            if (count == 1 && this[0] is Paragraph)
            {
                // Omit keyword if paragraph has no attributes set.
                Paragraph paragraph = (Paragraph)this[0];
                if (paragraph.Style == "" && paragraph.IsNull("Format"))
                {
                    paragraph.SerializeContentOnly = true;
                    paragraph.Serialize(serializer);
                    paragraph.SerializeContentOnly = false;
                    return;
                }
            }
            for (int index = 0; index < count; index++)
            {
                DocumentObject documentElement = this[index];
                documentElement.Serialize(serializer);
            }
        }