Пример #1
0
        // Styles styles
        public static Style CreateHeaderFooterStyle(string styleId)
        {
            //string styleId = "Header";
            //string styleName = "Header";

            Style style = new Style()
            {
                Type        = StyleValues.Paragraph,
                StyleId     = styleId,
                CustomStyle = true,
                Default     = false
            };

            style.StyleName = new StyleName()
            {
                Val = styleId
            };
            //if (styleAliases != "")
            //    style.Aliases = new Aliases() { Val = styleAliases };
            //style.AutoRedefine = new AutoRedefine() { Val = OnOffOnlyValues.Off };
            //style.BasedOn = new BasedOn() { Val = "Normal" };
            //style.LinkedStyle = new LinkedStyle() { Val = "Test" };
            //style.Locked = new Locked() { Val = OnOffOnlyValues.Off };
            //style.PrimaryStyle = new PrimaryStyle() { Val = OnOffOnlyValues.On };
            //style.StyleHidden = new StyleHidden() { Val = OnOffOnlyValues.Off };
            //style.SemiHidden = new SemiHidden() { Val = OnOffOnlyValues.Off };
            //style.NextParagraphStyle = new NextParagraphStyle() { Val = "Normal" };
            //style.UIPriority = new UIPriority() { Val = 1 };
            //style.UnhideWhenUsed = new UnhideWhenUsed() { Val = OnOffOnlyValues.On };

            StyleParagraphProperties styleParagraphProperties = new StyleParagraphProperties();
            // Tabs, <w:tabs>
            Tabs tabs = new Tabs();

            // Custom Tab Stop, <w:tab>
            tabs.AppendChild(new TabStop {
                Position = 4536, Val = TabStopValues.Center
            });
            tabs.AppendChild(new TabStop {
                Position = 9072, Val = TabStopValues.Right
            });
            styleParagraphProperties.Tabs  = tabs;
            style.StyleParagraphProperties = styleParagraphProperties;

            //StyleRunProperties styleRunProperties = new StyleRunProperties();
            //styleRunProperties.Bold = new Bold();
            //styleRunProperties.Color = new Color() { ThemeColor = ThemeColorValues.Accent2 };
            //styleRunProperties.RunFonts = new RunFonts() { Ascii = "Lucida Console" };
            //styleRunProperties.Italic = new Italic();
            //styleRunProperties.FontSize = new FontSize() { Val = "24" }; // 12 point size.
            //style.StyleRunProperties = styleRunProperties;

            //styles.Append(style);
            //return styleId;
            return(style);
        }
Пример #2
0
        // Styles styles
        public static Style CreateHeaderFooterStyle(string styleId)
        {
            //string styleId = "Header";
            //string styleName = "Header";

            Style style = new Style()
            {
                Type = StyleValues.Paragraph,
                StyleId = styleId,
                CustomStyle = true,
                Default = false
            };

            style.StyleName = new StyleName() { Val = styleId };
            //if (styleAliases != "")
            //    style.Aliases = new Aliases() { Val = styleAliases };
            //style.AutoRedefine = new AutoRedefine() { Val = OnOffOnlyValues.Off };
            //style.BasedOn = new BasedOn() { Val = "Normal" };
            //style.LinkedStyle = new LinkedStyle() { Val = "Test" };
            //style.Locked = new Locked() { Val = OnOffOnlyValues.Off };
            //style.PrimaryStyle = new PrimaryStyle() { Val = OnOffOnlyValues.On };
            //style.StyleHidden = new StyleHidden() { Val = OnOffOnlyValues.Off };
            //style.SemiHidden = new SemiHidden() { Val = OnOffOnlyValues.Off };
            //style.NextParagraphStyle = new NextParagraphStyle() { Val = "Normal" };
            //style.UIPriority = new UIPriority() { Val = 1 };
            //style.UnhideWhenUsed = new UnhideWhenUsed() { Val = OnOffOnlyValues.On };

            StyleParagraphProperties styleParagraphProperties = new StyleParagraphProperties();
            // Tabs, <w:tabs>
            Tabs tabs = new Tabs();
            // Custom Tab Stop, <w:tab>
            tabs.AppendChild(new TabStop { Position = 4536, Val = TabStopValues.Center });
            tabs.AppendChild(new TabStop { Position = 9072, Val = TabStopValues.Right });
            styleParagraphProperties.Tabs = tabs;
            style.StyleParagraphProperties = styleParagraphProperties;

            //StyleRunProperties styleRunProperties = new StyleRunProperties();
            //styleRunProperties.Bold = new Bold();
            //styleRunProperties.Color = new Color() { ThemeColor = ThemeColorValues.Accent2 };
            //styleRunProperties.RunFonts = new RunFonts() { Ascii = "Lucida Console" };
            //styleRunProperties.Italic = new Italic();
            //styleRunProperties.FontSize = new FontSize() { Val = "24" }; // 12 point size.
            //style.StyleRunProperties = styleRunProperties;

            //styles.Append(style);
            //return styleId;
            return style;
        }