Example #1
0
        /// <summary>
        /// Writes the Color object in its hexadecimal value.
        /// </summary>
        public override string ToString()
        {
            if (_stdColors == null)
            {
#if !SILVERLIGHT
                Array colorNames = Enum.GetNames(typeof(ColorName));
                Array colorValues = Enum.GetValues(typeof(ColorName));
                int count = colorNames.GetLength(0);
                _stdColors = new Dictionary<uint, string>(count);
                for (int index = 0; index < count; index++)
                {
                    string c = (string)colorNames.GetValue(index);
                    uint d = (uint)colorValues.GetValue(index);
                    // Some color are double named...
                    // Aqua == Cyan
                    // Fuchsia == Magenta
                    Style key = new Style();
                    if (!_stdColors.ContainsKey(d))
                        _stdColors.Add(d, c);
                }
#else
        _stdColors = new Dictionary<uint, string>();
        _stdColors.Add(0xFFF0F8FF, "AliceBlue");
        _stdColors.Add(0xFFFAEBD7, "AntiqueWhite");
        _stdColors.Add(0xFF00FFFF, "Aqua");
        _stdColors.Add(0xFF7FFFD4, "Aquamarine");
        _stdColors.Add(0xFFF0FFFF, "Azure");
        _stdColors.Add(0xFFF5F5DC, "Beige");
        _stdColors.Add(0xFFFFE4C4, "Bisque");
        _stdColors.Add(0xFF000000, "Black");
        _stdColors.Add(0xFFFFEBCD, "BlanchedAlmond");
        _stdColors.Add(0xFF0000FF, "Blue");
        _stdColors.Add(0xFF8A2BE2, "BlueViolet");
        _stdColors.Add(0xFFA52A2A, "Brown");
        _stdColors.Add(0xFFDEB887, "BurlyWood");
        _stdColors.Add(0xFF5F9EA0, "CadetBlue");
        _stdColors.Add(0xFF7FFF00, "Chartreuse");
        _stdColors.Add(0xFFD2691E, "Chocolate");
        _stdColors.Add(0xFFFF7F50, "Coral");
        _stdColors.Add(0xFF6495ED, "CornflowerBlue");
        _stdColors.Add(0xFFFFF8DC, "Cornsilk");
        _stdColors.Add(0xFFDC143C, "Crimson");
        //_stdColors.Add(0xFF00FFFF, "Cyan"); already added as "Aqua"
        _stdColors.Add(0xFF00008B, "DarkBlue");
        _stdColors.Add(0xFF008B8B, "DarkCyan");
        _stdColors.Add(0xFFB8860B, "DarkGoldenrod");
        _stdColors.Add(0xFFA9A9A9, "DarkGray");
        _stdColors.Add(0xFF006400, "DarkGreen");
        _stdColors.Add(0xFFBDB76B, "DarkKhaki");
        _stdColors.Add(0xFF8B008B, "DarkMagenta");
        _stdColors.Add(0xFF556B2F, "DarkOliveGreen");
        _stdColors.Add(0xFFFF8C00, "DarkOrange");
        _stdColors.Add(0xFF9932CC, "DarkOrchid");
        _stdColors.Add(0xFF8B0000, "DarkRed");
        _stdColors.Add(0xFFE9967A, "DarkSalmon");
        _stdColors.Add(0xFF8FBC8B, "DarkSeaGreen");
        _stdColors.Add(0xFF483D8B, "DarkSlateBlue");
        _stdColors.Add(0xFF2F4F4F, "DarkSlateGray");
        _stdColors.Add(0xFF00CED1, "DarkTurquoise");
        _stdColors.Add(0xFF9400D3, "DarkViolet");
        _stdColors.Add(0xFFFF1493, "DeepPink");
        _stdColors.Add(0xFF00BFFF, "DeepSkyBlue");
        _stdColors.Add(0xFF696969, "DimGray");
        _stdColors.Add(0xFF1E90FF, "DodgerBlue");
        _stdColors.Add(0xFFB22222, "Firebrick");
        _stdColors.Add(0xFFFFFAF0, "FloralWhite");
        _stdColors.Add(0xFF228B22, "ForestGreen");
        _stdColors.Add(0xFFFF00FF, "Fuchsia");
        _stdColors.Add(0xFFDCDCDC, "Gainsboro");
        _stdColors.Add(0xFFF8F8FF, "GhostWhite");
        _stdColors.Add(0xFFFFD700, "Gold");
        _stdColors.Add(0xFFDAA520, "Goldenrod");
        _stdColors.Add(0xFF808080, "Gray");
        _stdColors.Add(0xFF008000, "Green");
        _stdColors.Add(0xFFADFF2F, "GreenYellow");
        _stdColors.Add(0xFFF0FFF0, "Honeydew");
        _stdColors.Add(0xFFFF69B4, "HotPink");
        _stdColors.Add(0xFFCD5C5C, "IndianRed");
        _stdColors.Add(0xFF4B0082, "Indigo");
        _stdColors.Add(0xFFFFFFF0, "Ivory");
        _stdColors.Add(0xFFF0E68C, "Khaki");
        _stdColors.Add(0xFFE6E6FA, "Lavender");
        _stdColors.Add(0xFFFFF0F5, "LavenderBlush");
        _stdColors.Add(0xFF7CFC00, "LawnGreen");
        _stdColors.Add(0xFFFFFACD, "LemonChiffon");
        _stdColors.Add(0xFFADD8E6, "LightBlue");
        _stdColors.Add(0xFFF08080, "LightCoral");
        _stdColors.Add(0xFFE0FFFF, "LightCyan");
        _stdColors.Add(0xFFFAFAD2, "LightGoldenrodYellow");
        _stdColors.Add(0xFFD3D3D3, "LightGray");
        _stdColors.Add(0xFF90EE90, "LightGreen");
        _stdColors.Add(0xFFFFB6C1, "LightPink");
        _stdColors.Add(0xFFFFA07A, "LightSalmon");
        _stdColors.Add(0xFF20B2AA, "LightSeaGreen");
        _stdColors.Add(0xFF87CEFA, "LightSkyBlue");
        _stdColors.Add(0xFF778899, "LightSlateGray");
        _stdColors.Add(0xFFB0C4DE, "LightSteelBlue");
        _stdColors.Add(0xFFFFFFE0, "LightYellow");
        _stdColors.Add(0xFF00FF00, "Lime");
        _stdColors.Add(0xFF32CD32, "LimeGreen");
        _stdColors.Add(0xFFFAF0E6, "Linen");
        // _stdColors.Add(0xFFFF00FF, "Magenta"); already added as "Fuchsia"
        _stdColors.Add(0xFF800000, "Maroon");
        _stdColors.Add(0xFF66CDAA, "MediumAquamarine");
        _stdColors.Add(0xFF0000CD, "MediumBlue");
        _stdColors.Add(0xFFBA55D3, "MediumOrchid");
        _stdColors.Add(0xFF9370DB, "MediumPurple");
        _stdColors.Add(0xFF3CB371, "MediumSeaGreen");
        _stdColors.Add(0xFF7B68EE, "MediumSlateBlue");
        _stdColors.Add(0xFF00FA9A, "MediumSpringGreen");
        _stdColors.Add(0xFF48D1CC, "MediumTurquoise");
        _stdColors.Add(0xFFC71585, "MediumVioletRed");
        _stdColors.Add(0xFF191970, "MidnightBlue");
        _stdColors.Add(0xFFF5FFFA, "MintCream");
        _stdColors.Add(0xFFFFE4E1, "MistyRose");
        _stdColors.Add(0xFFFFE4B5, "Moccasin");
        _stdColors.Add(0xFFFFDEAD, "NavajoWhite");
        _stdColors.Add(0xFF000080, "Navy");
        _stdColors.Add(0xFFFDF5E6, "OldLace");
        _stdColors.Add(0xFF808000, "Olive");
        _stdColors.Add(0xFF6B8E23, "OliveDrab");
        _stdColors.Add(0xFFFFA500, "Orange");
        _stdColors.Add(0xFFFF4500, "OrangeRed");
        _stdColors.Add(0xFFDA70D6, "Orchid");
        _stdColors.Add(0xFFEEE8AA, "PaleGoldenrod");
        _stdColors.Add(0xFF98FB98, "PaleGreen");
        _stdColors.Add(0xFFAFEEEE, "PaleTurquoise");
        _stdColors.Add(0xFFDB7093, "PaleVioletRed");
        _stdColors.Add(0xFFFFEFD5, "PapayaWhip");
        _stdColors.Add(0xFFFFDAB9, "PeachPuff");
        _stdColors.Add(0xFFCD853F, "Peru");
        _stdColors.Add(0xFFFFC0CB, "Pink");
        _stdColors.Add(0xFFDDA0DD, "Plum");
        _stdColors.Add(0xFFB0E0E6, "PowderBlue");
        _stdColors.Add(0xFF800080, "Purple");
        _stdColors.Add(0xFFFF0000, "Red");
        _stdColors.Add(0xFFBC8F8F, "RosyBrown");
        _stdColors.Add(0xFF4169E1, "RoyalBlue");
        _stdColors.Add(0xFF8B4513, "SaddleBrown");
        _stdColors.Add(0xFFFA8072, "Salmon");
        _stdColors.Add(0xFFF4A460, "SandyBrown");
        _stdColors.Add(0xFF2E8B57, "SeaGreen");
        _stdColors.Add(0xFFFFF5EE, "SeaShell");
        _stdColors.Add(0xFFA0522D, "Sienna");
        _stdColors.Add(0xFFC0C0C0, "Silver");
        _stdColors.Add(0xFF87CEEB, "SkyBlue");
        _stdColors.Add(0xFF6A5ACD, "SlateBlue");
        _stdColors.Add(0xFF708090, "SlateGray");
        _stdColors.Add(0xFFFFFAFA, "Snow");
        _stdColors.Add(0xFF00FF7F, "SpringGreen");
        _stdColors.Add(0xFF4682B4, "SteelBlue");
        _stdColors.Add(0xFFD2B48C, "Tan");
        _stdColors.Add(0xFF008080, "Teal");
        _stdColors.Add(0xFFD8BFD8, "Thistle");
        _stdColors.Add(0xFFFF6347, "Tomato");
        _stdColors.Add(0x00FFFFFF, "Transparent");
        _stdColors.Add(0xFF40E0D0, "Turquoise");
        _stdColors.Add(0xFFEE82EE, "Violet");
        _stdColors.Add(0xFFF5DEB3, "Wheat");
        _stdColors.Add(0xFFFFFFFF, "White");
        _stdColors.Add(0xFFF5F5F5, "WhiteSmoke");
        _stdColors.Add(0xFFFFFF00, "Yellow");
        _stdColors.Add(0xFF9ACD32, "YellowGreen");
#endif
            }
            if (_isCmyk)
            {
                string s;
                if (Alpha == 100.0)
                    s = String.Format(CultureInfo.InvariantCulture, "CMYK({0:0.##},{1:0.##},{2:0.##},{3:0.##})", C, M, Y, K);
                else
                    s = String.Format(CultureInfo.InvariantCulture, "CMYK({0:0.##},{1:0.##},{2:0.##},{3:0.##},{4:0.##})", Alpha, C, M, Y, K);
                return s;
            }
            else
            {
                if (_stdColors.ContainsKey(_argb))
                    return _stdColors[_argb];
                if ((_argb & 0xFF000000) == 0xFF000000)
                    return "RGB(" +
                           ((_argb & 0xFF0000) >> 16) + "," +
                           ((_argb & 0x00FF00) >> 8) + "," +
                           (_argb & 0x0000FF) + ")";
                return "0x" + _argb.ToString("X");
            }
        }
Example #2
0
 /// <summary>
 /// Ensures that base styles are visited first.
 /// </summary>
 void VisitStyle(Dictionary<Style, object> visitedStyles, Style style, DocumentObjectVisitor visitor, bool visitChildren)
 {
     if (!visitedStyles.ContainsKey(style))
     {
         Style baseStyle = style.GetBaseStyle();
         if (baseStyle != null && !visitedStyles.ContainsKey(baseStyle)) //baseStyle != ""
             VisitStyle(visitedStyles, baseStyle, visitor, visitChildren);
         ((IVisitable)style).AcceptVisitor(visitor, visitChildren);
         visitedStyles.Add(style, null);
     }
 }
Example #3
0
 /// <summary>
 /// Adds a new style to the document styles.
 /// </summary>
 public void Add(Style style)
 {
   this.Styles.Add(style);
 }
Example #4
0
        /// <summary>
        /// Adds a new style to the styles collection.
        /// </summary>
        /// <param name="name">Name of the style.</param>
        /// <param name="baseStyleName">Name of the base style.</param>
        public Style AddStyle(string name, string baseStyleName)
        {
            if (name == null || baseStyleName == null)
                throw new ArgumentNullException(name == null ? "name" : "baseStyleName");
            if (name == "" || baseStyleName == "")
                throw new ArgumentException(name == "" ? "name" : "baseStyleName");

            Style style = new Style();
            style._name.Value = name;
            style._baseStyle.Value = baseStyleName;
            Add(style);
            // Add(style) may add a clone of style, therefore we return the style by name.
            return this[name];
        }
Example #5
0
        /// <summary>
        /// Initialize the built-in styles.
        /// </summary>
        internal void SetupStyles()
        {
            Style style;

            // First standard style.
            style = new Style(Style.DefaultParagraphFontName, null);
            style.IsReadOnly = true;
            style._styleType.Value = (int)StyleType.Character;
            style._buildIn.Value = true;
            Add(style);

            // Normal 'Standard' (Paragraph Style).
            style = new Style(Style.DefaultParagraphName, null);
            style._styleType.Value = (int)StyleType.Paragraph;
            style._buildIn.Value = true;
            style.Font.Name = "Arial";  // Not "Verdana" anymore.
            style.Font.Size = 10;
            style.Font.Bold = false;
            style.Font.Italic = false;
            style.Font.Underline = Underline.None;
            style.Font.Color = Colors.Black;
            style.Font.Subscript = false;
            style.Font.Superscript = false;
            style.ParagraphFormat.Alignment = ParagraphAlignment.Left;
            style.ParagraphFormat.FirstLineIndent = 0;
            style.ParagraphFormat.LeftIndent = 0;
            style.ParagraphFormat.RightIndent = 0;
            style.ParagraphFormat.KeepTogether = false;
            style.ParagraphFormat.KeepWithNext = false;
            style.ParagraphFormat.SpaceBefore = 0;
            style.ParagraphFormat.SpaceAfter = 0;
            style.ParagraphFormat.LineSpacing = 10;
            style.ParagraphFormat.LineSpacingRule = LineSpacingRule.Single;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.BodyText;
            style.ParagraphFormat.PageBreakBefore = false;
            style.ParagraphFormat.WidowControl = true;
            Add(style);

            // Heading1 'Überschrift 1' (Paragraph Style).
            style = new Style(StyleNames.Heading1, StyleNames.Normal);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
            Add(style);

            // Heading2 'Überschrift 2' (Paragraph Style).
            style = new Style(StyleNames.Heading2, StyleNames.Heading1);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level2;
            Add(style);

            // Heading3 'Überschrift 3' (Paragraph Style).
            style = new Style(StyleNames.Heading3, StyleNames.Heading2);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level3;
            Add(style);

            // Heading4 'Überschrift 4' (Paragraph Style).
            style = new Style(StyleNames.Heading4, StyleNames.Heading3);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level4;
            Add(style);

            // Heading5 'Überschrift 5' (Paragraph Style).
            style = new Style(StyleNames.Heading5, StyleNames.Heading4);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level5;
            Add(style);

            // Heading6 'Überschrift 6' (Paragraph Style).
            style = new Style(StyleNames.Heading6, StyleNames.Heading5);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level6;
            Add(style);

            // Heading7 'Überschrift 7' (Paragraph Style).
            style = new Style(StyleNames.Heading7, StyleNames.Heading6);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level7;
            Add(style);

            // Heading8 'Überschrift 8' (Paragraph Style).
            style = new Style(StyleNames.Heading8, StyleNames.Heading7);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level8;
            Add(style);

            // Heading9 'Überschrift 9' (Paragraph Style).
            style = new Style(StyleNames.Heading9, StyleNames.Heading8);
            style._buildIn.Value = true;
            style.ParagraphFormat.OutlineLevel = OutlineLevel.Level9;
            Add(style);

            // List 'Liste' (Paragraph Style).
            style = new Style(StyleNames.List, StyleNames.Normal);
            style._buildIn.Value = true;
            Add(style);

            // Footnote 'Fußnote' (Paragraph Style).
            style = new Style(StyleNames.Footnote, StyleNames.Normal);
            style._buildIn.Value = true;
            Add(style);

            // Header 'Kopfzeile' (Paragraph Style).
            style = new Style(StyleNames.Header, StyleNames.Normal);
            style._buildIn.Value = true;
            Add(style);

            // -33: Footer 'Fußzeile' (Paragraph Style).
            style = new Style(StyleNames.Footer, StyleNames.Normal);
            style._buildIn.Value = true;
            Add(style);

            // Hyperlink 'Hyperlink' (Character Style).
            style = new Style(StyleNames.Hyperlink, StyleNames.DefaultParagraphFont);
            style._buildIn.Value = true;
            Add(style);

            // InvalidStyleName 'Ungültiger Formatvorlagenname' (Paragraph Style).
            style = new Style(StyleNames.InvalidStyleName, StyleNames.Normal);
            style._buildIn.Value = true;
            style.Font.Bold = true;
            style.Font.Underline = Underline.Dash;
            style.Font.Color = new Color(0xFF00FF00);
            Add(style);
        }
Example #6
0
 /// <summary>
 /// Sets a paragraph style.
 /// </summary>
 /// <param name="style">The style.</param>
 /// <param name="ps">The ps.</param>
 private static void SetStyle(Style style, ParagraphStyle ps)
 {
     style.Font.Name = ps.FontFamily;
     style.Font.Size = Unit.FromPoint(ps.FontSize);
     style.Font.Bold = ps.Bold;
     style.Font.Italic = ps.Italic;
     style.Font.Color = ToMigraDocColor(ps.TextColor);
     style.ParagraphFormat.PageBreakBefore = ps.PageBreakBefore;
     style.ParagraphFormat.LeftIndent = Unit.FromPoint(ps.LeftIndentation);
     style.ParagraphFormat.RightIndent = Unit.FromPoint(ps.RightIndentation);
     style.ParagraphFormat.LineSpacing = Unit.FromPoint(ps.LineSpacing);
     style.ParagraphFormat.SpaceBefore = Unit.FromPoint(ps.SpacingBefore);
     style.ParagraphFormat.SpaceAfter = Unit.FromPoint(ps.SpacingAfter);
 }
Example #7
0
        /// <summary>
        /// Initialize the built in styles.
        /// </summary>
        internal void SetupStyles()
        {
            Style style;

              // First standard style
              style = new Style(Style.DefaultParagraphFontName, null);
              style.readOnly = true;
              style.styleType.Value = (int)StyleType.Character;
              style.buildIn.Value = true;
              this.Add(style);

              // Normal 'Standard' (Paragraph Style)
              style = new Style(Style.DefaultParagraphName, null);
              style.styleType.Value = (int)StyleType.Paragraph;
              style.buildIn.Value = true;
              style.Font.Name = "Verdana";
              style.Font.Size = 10;
              style.Font.Bold = false;
              style.Font.Italic = false;
              style.Font.Underline = Underline.None;
              style.Font.Color = Colors.Black;
              style.Font.Subscript = false;
              style.Font.Superscript = false;
              style.ParagraphFormat.Alignment = ParagraphAlignment.Left;
              style.ParagraphFormat.FirstLineIndent = 0;
              style.ParagraphFormat.LeftIndent = 0;
              style.ParagraphFormat.RightIndent = 0;
              style.ParagraphFormat.KeepTogether = false;
              style.ParagraphFormat.KeepWithNext = false;
              style.ParagraphFormat.SpaceBefore = 0;
              style.ParagraphFormat.SpaceAfter = 0;
              style.ParagraphFormat.LineSpacing = 10;
              style.ParagraphFormat.LineSpacingRule = LineSpacingRule.Single;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.BodyText;
              style.ParagraphFormat.PageBreakBefore = false;
              style.ParagraphFormat.WidowControl = true;
              this.Add(style);

              // Heading1 'Überschrift 1' (Paragraph Style)
              style = new Style("Heading1", "Normal");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
              this.Add(style);

              // Heading2 'Überschrift 2' (Paragraph Style)
              style = new Style("Heading2", "Heading1");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level2;
              this.Add(style);

              // Heading3 'Überschrift 3' (Paragraph Style)
              style = new Style("Heading3", "Heading2");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level3;
              this.Add(style);

              // Heading4 'Überschrift 4' (Paragraph Style)
              style = new Style("Heading4", "Heading3");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level4;
              this.Add(style);

              // Heading5 'Überschrift 5' (Paragraph Style)
              style = new Style("Heading5", "Heading4");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level5;
              this.Add(style);

              // Heading6 'Überschrift 6' (Paragraph Style)
              style = new Style("Heading6", "Heading5");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level6;
              this.Add(style);

              // Heading7 'Überschrift 7' (Paragraph Style)
              style = new Style("Heading7", "Heading6");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level7;
              this.Add(style);

              // Heading8 'Überschrift 8' (Paragraph Style)
              style = new Style("Heading8", "Heading7");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level8;
              this.Add(style);

              // Heading9 'Überschrift 9' (Paragraph Style)
              style = new Style("Heading9", "Heading8");
              style.buildIn.Value = true;
              style.ParagraphFormat.OutlineLevel = OutlineLevel.Level9;
              this.Add(style);

              // List 'Liste' (Paragraph Style)
              style = new Style("List", "Normal");
              style.buildIn.Value = true;
              this.Add(style);

              // Footnote 'Fußnote' (Paragraph Style)
              style = new Style("Footnote", "Normal");
              style.buildIn.Value = true;
              this.Add(style);

              // Header 'Kopfzeile' (Paragraph Style)
              style = new Style("Header", "Normal");
              style.buildIn.Value = true;
              this.Add(style);

              // -33: Footer 'Fußzeile' (Paragraph Style)
              style = new Style("Footer", "Normal");
              style.buildIn.Value = true;
              this.Add(style);

              // Hyperlink 'Hyperlink' (Character Style)
              style = new Style("Hyperlink", "DefaultParagraphFont");
              style.buildIn.Value = true;
              this.Add(style);

              // InvalidStyleName 'Ungültiger Formatvorlagenname' (Paragraph Style)
              style = new Style("InvalidStyleName", "Normal");
              style.buildIn.Value = true;
              style.Font.Bold = true;
              style.Font.Underline = Underline.Dash;
              style.Font.Color = new Color(0xFF00FF00);
              this.Add(style);
        }
Example #8
0
        /// <summary>
        /// Adds a new style to the styles collection.
        /// </summary>
        /// <param name="name">Name of the style.</param>
        /// <param name="baseStyleName">Name of the base style.</param>
        public Style AddStyle(string name, string baseStyleName)
        {
            if (name == null || baseStyleName == null)
            throw new ArgumentNullException(name == null ? "name" : "baseStyleName");
              if (name == "" || baseStyleName == "")
            throw new ArgumentException(name == "" ? "name" : "baseStyleName");

              Style style = new Style();
              style.name.Value = name;
              style.baseStyle.Value = baseStyleName;
              this.Add(style);
              return style;
        }
Example #9
0
 /// <summary>
 /// Adds a new style to the document styles.
 /// </summary>
 public void Add(Style style)
 {
     Styles.Add(style);
 }
Example #10
0
 internal StyleRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer)
     : base(domObj, docRenderer)
 {
     this.style = domObj as Style;
       this.styles = DocumentRelations.GetParent(this.style) as Styles;
 }