iTextSharp.text.html.HtmlEncoder.GetAlignment C# (CSharp) Метод

GetAlignment() публичный статический Метод

public static GetAlignment ( int alignment ) : String
alignment int
Результат String
        public static String GetAlignment(int alignment)
        {
            switch (alignment) {
                case Element.ALIGN_LEFT:
                    return HtmlTags.ALIGN_LEFT;
                case Element.ALIGN_CENTER:
                    return HtmlTags.ALIGN_CENTER;
                case Element.ALIGN_RIGHT:
                    return HtmlTags.ALIGN_RIGHT;
                case Element.ALIGN_JUSTIFIED:
                case Element.ALIGN_JUSTIFIED_ALL:
                    return HtmlTags.ALIGN_JUSTIFY;
                case Element.ALIGN_TOP:
                    return HtmlTags.ALIGN_TOP;
                case Element.ALIGN_MIDDLE:
                    return HtmlTags.ALIGN_MIDDLE;
                case Element.ALIGN_BOTTOM:
                    return HtmlTags.ALIGN_BOTTOM;
                case Element.ALIGN_BASELINE:
                    return HtmlTags.ALIGN_BASELINE;
                default:
                    return "";
            }
        }

Usage Example

Пример #1
0
        /**
         * Writes the HTML representation of a section.
         *
         * @param   section     the section to write
         * @param   indent      the indentation
         */

        protected void WriteSection(Section section, int indent)
        {
            if (section.Title != null)
            {
                int depth = section.Depth - 1;
                if (depth > 5)
                {
                    depth = 5;
                }
                Properties styleAttributes = new Properties();
                if (section.Title.LeadingDefined)
                {
                    styleAttributes[MarkupTags.CSS_KEY_LINEHEIGHT] = section.Title.Leading.ToString() + "pt";
                }
                // start tag
                AddTabs(indent);
                WriteStart(HtmlTags.H[depth]);
                Write(section.Title.Font, styleAttributes);
                String alignment = HtmlEncoder.GetAlignment(section.Title.Alignment);
                if (!"".Equals(alignment))
                {
                    Write(HtmlTags.ALIGN, alignment);
                }
                if (HasMarkupAttributes(section.Title))
                {
                    WriteMarkupAttributes(section.Title);
                }
                os.WriteByte(GT);
                currentfont.Push(section.Title.Font);
                // contents
                foreach (IElement i in section.Title)
                {
                    Write(i, indent + 1);
                }
                // end tag
                AddTabs(indent);
                WriteEnd(HtmlTags.H[depth]);
                currentfont.Pop();
            }
            foreach (IElement i in section)
            {
                Write(i, indent);
            }
        }
All Usage Examples Of iTextSharp.text.html.HtmlEncoder::GetAlignment