コード例 #1
0
 private void AddNumberingProps(CssClass cssClass, RunClassParam param)
 {
     if (!param.NumberingId.HasValue || !param.NumberingLevel.HasValue)
     {
         return;
     }
     cssClass.Props.AddMany(_numPropsCache.Get(param.NumberingId.Value, param.NumberingLevel.Value));
 }
コード例 #2
0
 private void AddRunStyle(CssClass cssClass, string styleId)
 {
     if (styleId == null)
     {
         return;
     }
     cssClass.Props.AddMany(_rStylePropsCache.Get(styleId));
 }
コード例 #3
0
 private void AddOrSet(CssClass cssClass, CssPropertiesSet props)
 {
     if (cssClass.Props.Count > 0)
     {
         cssClass.Props.AddMany(props);
     }
     else
     {
         cssClass.Props = props;
     }
 }
コード例 #4
0
 private void AddNumberingStyleProps(ParagraphClassParam param, CssClass cssClass)
 {
     if (!param.NumberingId.HasValue || !param.NumberingLevel.HasValue)
     {
         return;
     }
     AddOrSet(
         cssClass,
         _numPropsCache.Get(
             param.NumberingId.Value,
             param.NumberingLevel.Value));
 }
コード例 #5
0
 private void AddTableStyle(CssClass cssClass, List <OpenXmlElement> tableProperties)
 {
     if (tableProperties == null || tableProperties.Count == 0)
     {
         return;
     }
     for (int i = tableProperties.Count - 1; i >= 0; i--)
     {
         var cssPropSet = _propsFac.Build(tableProperties[i]);
         cssClass.Props.AddMany(cssPropSet);
     }
 }
コード例 #6
0
 private void AddStyleProps(string styleId, CssClass cssClass)
 {
     if (styleId != null)
     {
         AddOrSet(cssClass, _stylePropsCache.Get(styleId));
         return;
     }
     if (_defaultsProvider.DefaultParagraphStyle != null)
     {
         var props = _stylePropsCache.Get(_defaultsProvider.DefaultParagraphStyle);
         AddOrSet(cssClass, props);
     }
 }
コード例 #7
0
 private void AddTableProps(List <OpenXmlElement> tableProperties, CssClass cssClass)
 {
     if (tableProperties == null || tableProperties.Count == 0)
     {
         return;
     }
     for (int i = tableProperties.Count - 1; i >= 0; i--)
     {
         var elem  = tableProperties[i];
         var props = _propsFac.Build(elem);
         AddOrSet(cssClass, props);
     }
 }
コード例 #8
0
 private void AddRunStyle(CssClass cssClass, string styleId)
 {
     if (styleId != null)
     {
         cssClass.Props.AddMany(_rStylePropsCache.Get(styleId));
         return;
     }
     if (_defaults.DefaultRunStyle != null)
     {
         var props = _rStylePropsCache.Get(_defaults.DefaultRunStyle);
         cssClass.Props.AddMany(props);
     }
 }
コード例 #9
0
        public CssClass Build(ParagraphClassParam param)
        {
            var cssClass = new CssClass();

            cssClass.Props = BuildInline(param.InlineProperties);
            //AddVanish(param, cssClass);
            AddNumberingStyleProps(param, cssClass);
            AddStyleProps(param.StyleId, cssClass);
            AddTableProps(param.TableProperties, cssClass);
            AddDefaultsProps(cssClass);
            cssClass.Name = GenerateDynName();
            cssClass.Tag  = Tag;
            return(cssClass);
        }
コード例 #10
0
        public CssClass Build(RunClassParam param)
        {
            var cssClass = new CssClass {
                Name = GenerageDynamicName()
            };
            var inline = BuildInline(param.InlineProperties);

            // This is according to me
            cssClass.Props.AddMany(inline);
            AddRunStyle(cssClass, param.RunStyleId);
            AddNumberingProps(cssClass, param);
            AddParagraphStyle(cssClass, param.ParagraphStyleId);
            AddTableStyle(cssClass, param.TableProperties);
            AddDefaults(cssClass);
            return(cssClass);
        }
コード例 #11
0
        private void AddVanish(ParagraphClassParam param, CssClass cssClass)
        {
            var vanish = param.InlineProperties?.Descendants <Vanish>().FirstOrDefault();

            if (vanish != null)
            {
                cssClass.Props.Add(new Properties.VanishCssProperty()
                {
                    OpenXmlElement = vanish
                });
            }
            var specVanish = param.InlineProperties?.Descendants <SpecVanish>().FirstOrDefault();

            if (specVanish != null)
            {
                cssClass.Props.Add(new Properties.SpecVanishCssProperty()
                {
                    OpenXmlElement = specVanish
                });
            }
        }
コード例 #12
0
 private void AddDefaultsProps(CssClass cssClass)
 {
     AddOrSet(cssClass, _defaultsProvider.Paragraph);
 }
コード例 #13
0
 private void AddDefaults(CssClass cssClass)
 {
     cssClass.Props.AddMany(_defaults.Run);
 }