Пример #1
0
        /// <summary>
        /// Returns a Phrase that has been constructed taking in account
        /// the value of some attributes.
        /// </summary>
        /// <param name="attributes">some attributes</param>
        public Phrase(Properties attributes) : this("", FontFactory.getFont(attributes))
        {
            this.Clear();
            string value;

            if ((value = attributes.Remove(ElementTags.LEADING)) != null)
            {
                Leading = float.Parse(value);
            }
            else if ((value = attributes.Remove(MarkupTags.CSS_LINEHEIGHT)) != null)
            {
                Leading = MarkupParser.parseLength(value);
            }
            if ((value = attributes.Remove(ElementTags.ITEXT)) != null)
            {
                Chunk chunk = new Chunk(value);
                if ((value = attributes.Remove(ElementTags.GENERICTAG)) != null)
                {
                    chunk.setGenericTag(value);
                }
                Add(chunk);
            }
            if (attributes.Count > 0)
            {
                MarkupAttributes = attributes;
            }
        }
Пример #2
0
        /// <summary>
        /// Returns a Paragraph that has been constructed taking in account
        /// the value of some attributes.
        /// </summary>
        /// <param name="attributes">Some attributes</param>
        public Paragraph(Properties attributes) : this("", FontFactory.getFont(attributes))
        {
            string value;

            if ((value = attributes.Remove(ElementTags.ITEXT)) != null)
            {
                Chunk chunk = new Chunk(value);
                if ((value = attributes.Remove(ElementTags.GENERICTAG)) != null)
                {
                    chunk.setGenericTag(value);
                }
                Add(chunk);
            }
            if ((value = attributes.Remove(ElementTags.ALIGN)) != null)
            {
                setAlignment(value);
            }
            if ((value = attributes.Remove(ElementTags.LEADING)) != null)
            {
                this.Leading = float.Parse(value);
            }
            else if ((value = attributes.Remove(MarkupTags.CSS_LINEHEIGHT)) != null)
            {
                this.Leading = MarkupParser.parseLength(value);
            }
            else
            {
                this.Leading = 16;
            }
            if ((value = attributes.Remove(ElementTags.INDENTATIONLEFT)) != null)
            {
                this.IndentationLeft = float.Parse(value);
            }
            if ((value = attributes.Remove(ElementTags.INDENTATIONRIGHT)) != null)
            {
                IndentationRight = float.Parse(value);
            }
            if ((value = attributes.Remove(ElementTags.KEEPTOGETHER)) != null)
            {
                keeptogether = bool.Parse(value);
            }
            if (attributes.Count > 0)
            {
                MarkupAttributes = attributes;
            }
        }