コード例 #1
0
        /// <summary>
        /// Merge with another inline styles
        /// </summary>
        /// <param name="styles">Styles to be merged with</param>
        /// <param name="overrideWhenConflict">
        /// Value indicating whether single style should be overriden
        /// if another style is found in styles provided as parameter
        /// </param>
        public void MergeWith(InlineStyles styles, bool overrideWhenConflict)
        {
            if (styles == null)
            {
                throw new ArgumentException("Can't merge with empty styles");
            }

            foreach (var style in styles.Values)
            {
                if (this.Values.ContainsKey(style.Key))
                {
                    if (overrideWhenConflict)
                    {
                        // Override existing style
                        this.Values[style.Key] = style.Value;
                    }
                    // Otherwise leave current value
                }
                else
                {
                    this.Values.Add(style.Key, style.Value);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Add <td></td> to the list of child elements
 /// </summary>
 /// <param name="elementCfg">Element configuration</param>
 /// <param name="styles">Element styles</param>
 public void AddCell(Action <HtmlTableCell> elementCfg, InlineStyles styles)
 => this.AddChild <HtmlTableCell, InlineStyles>(elementCfg, styles);
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlDiv"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlDiv(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlBody"/> class.
 /// </summary>
 /// <param name="styles">Styles configuration</param>
 public HtmlBody(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #5
0
 /// <summary>
 /// Add <body></body> to the list of child elements
 /// </summary>
 /// <param name="elementCfg">Element configuration</param>
 /// <param name="styles">Element styles</param>
 public void AddBody(Action <HtmlBody> elementCfg, InlineStyles styles)
 => this.AddChild <HtmlBody, InlineStyles>(elementCfg, styles);
コード例 #6
0
 /// <summary>
 /// Add <head></head> to the list of child elements
 /// </summary>
 /// <param name="elementCfg">Element configuration</param>
 /// <param name="styles">Element styles</param>
 public void AddHead(Action <HtmlHead> elementCfg, InlineStyles styles)
 => this.AddChild <HtmlHead, InlineStyles>(elementCfg, styles);
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlDocument"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlDocument(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlSpan"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlSpan(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #9
0
 /// <summary>
 /// Add <tr></tr> to the list of child elements
 /// </summary>
 /// <param name="elementCfg">Element configuration</param>
 /// <param name="styles">Element styles</param>
 public void AddRow(Action <HtmlTableRow> elementCfg, InlineStyles styles)
 => this.AddChild <HtmlTableRow, InlineStyles>(elementCfg, styles);
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlParagraph"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlParagraph(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlHeader"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlHeader(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlTable"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlTable(InlineStyles styles)
     : base(styles)
 {
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlNewLine"/> class.
 /// </summary>
 /// <param name="styles">Inline styles</param>
 public HtmlNewLine(InlineStyles styles)
     : base(styles)
 {
 }