Example #1
0
        public IStyle AddStyle(string name)
        {
            var characterStyleName = StyleHelper.GetCharacterStyleName(name);

            var characterStyle = CreateStyle(characterStyleName, StyleValues.Character, name);
            var paragraphStyle = CreateStyle(name, StyleValues.Paragraph, characterStyleName);

            var wordStyle = new WordStyle(new[] { characterStyle, paragraphStyle });

            _styles.Add(wordStyle);

            return(wordStyle);
        }
Example #2
0
        public void AddText(string text, string style = null)
        {
            var characterStyleName = StyleHelper.GetCharacterStyleName(style);

            var run           = new Run();
            var runProperties = new RunProperties {
                RunStyle = new RunStyle {
                    Val = characterStyleName
                }
            };

            run.Append(runProperties);

            run.Append(new Text(text));

            _paragraph.Append(run);
        }