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); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
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); } }
/// <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; }