Example #1
0
        public CssStyle GetStyle(Style s, Style linkedStyle)
        {
            CssStyle cs = this.GetStyle(s);

            cs.CombineStyles(this.GetStyle(linkedStyle));
            return(cs);
        }
Example #2
0
        public CssStyle GetStyle(Style s, StyleConfig config = null)
        {
            CssStyle cs = new CssStyle();

            if (s == null)
            {
                return(cs);
            }
            var id   = s.StyleId;
            var type = s.Type.ToString();

            if (type == "paragraph")
            {
                if (s.StyleParagraphProperties != null)
                {
                    CssStyle cS = this.GetStyleFromParagraphProperties(new ParagraphProperties(s.StyleParagraphProperties.OuterXml), config);
                    cS.Selector = ".Inner_P_" + id;
                    if (s.StyleRunProperties != null)
                    {
                        CssStyle cSs = this.GetStyleFromRunProperties(new RunProperties(s.StyleRunProperties.OuterXml), config);
                        cS.CombineStyles(cSs);
                    }
                    return(cS);
                }
            }
            else if (type == "character")
            {
                if (s.StyleRunProperties != null)
                {
                    CssStyle cS = this.GetStyleFromRunProperties(new RunProperties(s.StyleRunProperties.OuterXml), config);
                    cS.Selector = ".Inner_R_" + id;
                    return(cS);
                }
            }
            else if (type == "table")
            {
                if (s.StyleTableProperties != null)
                {
                    CssStyle cS = this.GetStyleFromTableProperties(new TableProperties(s.StyleTableProperties.OuterXml), config);
                    cS.Selector = ".Inner_T_" + id;
                    return(cS);
                }
            }
            else if (type == "numbering")
            {
            }
            else if (type == "direct")
            {
            }
            return(cs);
        }
Example #3
0
        public CssStyle GetStyleFromParagraphProperties(ParagraphProperties p, StyleConfig config = null)
        {
            CssStyle style = new CssStyle(null);
            var      pPr   = p;

            if (pPr != null)
            {
                if (pPr.Justification != null)
                {
                    var jc = pPr.Justification;
                    style.AddStyle("text-align", jc.Val);
                }
                if (pPr.ParagraphMarkRunProperties != null)
                {
                    RunProperties rPr = new RunProperties(pPr.ParagraphMarkRunProperties.OuterXml);
                    CssStyle      p_s = this.GetStyleFromRunProperties(rPr, config);
                    style.CombineStyles(p_s);
                }
            }
            return(style);
        }