Exemple #1
0
        public static HeaderStyle CreateFromXElement(XElement element)
        {
            XNamespace xmlns = element.Name.Namespace;

            HeaderStyle headerStyle;
            if (element.Name.Equals(xmlns + PdfElementKind.H1.DisplayName()))
            {
                headerStyle = new H1Style();
            }
            else if (element.Name.Equals(xmlns + PdfElementKind.H2.DisplayName()))
            {
                headerStyle = new H2Style();
            }
            else if (element.Name.Equals(xmlns + PdfElementKind.H3.DisplayName()))
            {
                headerStyle = new H3Style();
            }
            else if (element.Name.Equals(xmlns + PdfElementKind.H4.DisplayName()))
            {
                headerStyle = new H4Style();
            }
            else if (element.Name.Equals(xmlns + PdfElementKind.H5.DisplayName()))
            {
                headerStyle = new H5Style();
            }
            else if (element.Name.Equals(xmlns + PdfElementKind.H6.DisplayName()))
            {
                headerStyle = new H6Style();
            }
            else
            {
                throw new NotSupportedException(String.Format("'{0}' Header Style Type Not Supported.", element.Name.LocalName));
            }

            headerStyle.PopulateFromXElement(element);

            return headerStyle;
        }
Exemple #2
0
 protected Header()
     : base()
 {
     if (this is H1)
     {
         Style = new H1Style();
     }
     else if (this is H2)
     {
         Style = new H2Style();
     }
     else if (this is H3)
     {
         Style = new H3Style();
     }
     else if (this is H4)
     {
         Style = new H5Style();
     }
     else if (this is H5)
     {
         Style = new H5Style();
     }
     else if (this is H6)
     {
         Style = new H6Style();
     }
     else
     {
         throw new NotSupportedException(String.Format("'{0}' Header Style Type Not Supported.", this.GetType().Name));
     }
 }