public static string ToHtmlTag(this HtmlHeadingType heading)
    {
        switch (heading)
        {
        case HtmlHeadingType.H1:
            return("h1");

        case HtmlHeadingType.H2:
            return("h2");

        case HtmlHeadingType.H3:
            return("h3");

        case HtmlHeadingType.H4:
            return("h4");

        case HtmlHeadingType.H5:
            return("h5");

        case HtmlHeadingType.H6:
            return("h6");

        default:
            throw new AbpException("Unknown HtmlHeadingType: " + heading);
        }
    }
Example #2
0
        private void bHeading_Click(object sender, System.EventArgs e)
        {
            int headingRef = this.listHeadings.SelectedIndex + 1;

            if (headingRef > 0)
            {
                HtmlHeadingType headingType = (HtmlHeadingType)headingRef;
                this.htmlEditorControl.InsertHeading(headingType);
            }
            this.htmlEditorControl.Focus();
        }
        /// <summary>
        /// Method to insert a heading tag values being Heading 1,2,3,4,5
        /// </summary>
        public void InsertHeading(HtmlHeadingType headingType)
        {
            // obtain the selected range object
            mshtmlTextRange range = GetTextRange();

            // determine the appropriate heading tag and insert the heading
            string command = string.Format("{0} {1}", HTML_FORMATTED_HEADING, (int)headingType);
            InsertFormatBlock(command);
        }