예제 #1
0
 public HeaderFooterOption(System.Drawing.Font font, Color color, string alignmentString)
 {
     this.color          = color;
     this.FontName       = font.Name;
     this.FontSize       = font.Size;
     this.bold           = font.Bold;
     this.italic         = font.Italic;
     this.underlineStyle = font.Underline ? UnderlineStyle.singleLine : UnderlineStyle.none;
     this.strikeThrough  = font.Strikeout ? StrikeThrough.strike : StrikeThrough.none;
     this.alignment      = setAlignment(alignmentString);
 }
예제 #2
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle      = CapsStyle.none;
            strikethrough  = StrikeThrough.none;
            script         = Script.none;
            highlight      = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc           = Misc.none;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
예제 #3
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle = CapsStyle.none;
            strikethrough = StrikeThrough.none;
            script = Script.none;
            highlight = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc = Misc.none;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
예제 #4
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle      = CapsStyle.none;
            strikethrough  = StrikeThrough.none;
            script         = Script.none;
            highlight      = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc           = Misc.none;

            // Use current culture by default
            language = CultureInfo.CurrentCulture;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
예제 #5
0
        /// <summary>
        /// A text formatting.
        /// </summary>
        public Formatting()
        {
            capsStyle = CapsStyle.none;
            strikethrough = StrikeThrough.none;
            script = Script.none;
            highlight = Highlight.none;
            underlineStyle = UnderlineStyle.none;
            misc = Misc.none;

            // Use current culture by default
            language = CultureInfo.CurrentCulture;

            rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName));
        }
예제 #6
0
        public static string ConvertPairedMarkdownToHtml(this string input, string markdownTag, MarkdownParser.PairedMarkdownTags tag)
        {
            try
            {
                string output   = string.Empty;
                var    tagSplit = input.Split(new string[] { markdownTag }, StringSplitOptions.None);

                for (int i = 0; i < tagSplit.Length; i++)
                {
                    if (i != 0 && i != tagSplit.Length - 1)
                    {
                        if (tagSplit[i][0] != ' ' && tagSplit[i][tagSplit[i].Length - 1] != ' ')
                        {
                            if (!(tagSplit[i][0] == '~' || tagSplit[i][0] == '_' || tagSplit[i][0] == '*' ||
                                  tagSplit[i][tagSplit[i].Length - 1] == '~' || tagSplit[i][tagSplit[i].Length - 1] == '_' || tagSplit[i][tagSplit[i].Length - 1] == '*'))
                            {
                                if (tag == MarkdownParser.PairedMarkdownTags.Bold)
                                {
                                    tagSplit[i] = new Bold(tagSplit[i]).ToString();
                                }
                                else if (tag == MarkdownParser.PairedMarkdownTags.Italic)
                                {
                                    tagSplit[i] = new Italic(tagSplit[i]).ToString();
                                }
                                else if (tag == MarkdownParser.PairedMarkdownTags.InlineCode)
                                {
                                    tagSplit[i] = new InlineCode(tagSplit[i]).ToString();
                                }
                                else if (tag == MarkdownParser.PairedMarkdownTags.StrikeThrough)
                                {
                                    tagSplit[i] = new StrikeThrough(tagSplit[i]).ToString();
                                }
                            }
                        }
                    }
                    output += tagSplit[i];
                }

                return(output);
            }
            catch (Exception e)
            {
                throw new Exception("An error occured while converting paired Markdown to HTML. " + e.Message);
            }
        }
예제 #7
0
파일: Paragraph.cs 프로젝트: kozanid/DocX
        /// <summary>
        /// For use with Append() and AppendLine()
        /// </summary>
        /// <param name="strikeThrough">The strike through style to used on the last appended text.</param>
        /// <returns>This Paragraph with the last appended text striked.</returns>
        /// <example>
        /// Append text to this Paragraph and then strike it.
        /// <code>
        /// // Create a document.
        /// using (DocX document = DocX.Create(@"Test.docx"))
        /// {
        ///     // Insert a new Paragraph.
        ///     Paragraph p = document.InsertParagraph();
        ///
        ///     p.Append("I am ")
        ///     .Append("striked").StrikeThrough(StrikeThrough.doubleStrike)
        ///     .Append(" I am not");
        ///        
        ///     // Save this document.
        ///     document.Save();
        /// }// Release this document from memory.
        /// </code>
        /// </example>
        public Paragraph StrikeThrough(StrikeThrough strikeThrough)
        {
            string value;
            switch (strikeThrough)
            {
                case Novacode.StrikeThrough.strike: value = "strike"; break;
                case Novacode.StrikeThrough.doubleStrike: value = "dstrike"; break;
                default: return this;
            }

            ApplyTextFormattingProperty(XName.Get(value, DocX.w.NamespaceName), string.Empty, null);

            return this;
        }