public override void BeginMarkup(DocumentMarkupKind markupKind) { switch (markupKind) { case DocumentMarkupKind.Bold: writer.Write(@"\textbf{"); break; case DocumentMarkupKind.Emphasis: writer.Write(@"\textem{"); break; case DocumentMarkupKind.Small: writer.Write(@"\texttt{\small "); break; case DocumentMarkupKind.SubScript: writer.Write(@"_{"); break; case DocumentMarkupKind.SuperScript: writer.Write(@"^{"); break; case DocumentMarkupKind.Fail: writer.Write(@"\colorbox[rgb]{0.89,0,0.19}{"); break; case DocumentMarkupKind.Success: writer.Write(@"\colorbox[rgb]{0.52,0.98,0.6}{"); break; default: throw new DocumentException("Invalid DocumentMarkupKind: " + markupKind); } this.paraBegin = false; }
public override void BeginMarkup(DocumentMarkupKind markupKind) { switch (markupKind) { case DocumentMarkupKind.Bold: writer.Write("'''"); break; case DocumentMarkupKind.ComputerOutput: writer.Write("<pre>"); break; case DocumentMarkupKind.Emphasis: writer.Write("''"); break; case DocumentMarkupKind.Center: writer.Write("<center>"); break; case DocumentMarkupKind.Success: writer.Write(" <span style=\"background: #85FA99\">"); break; case DocumentMarkupKind.Fail: writer.Write(" <span style=\"background: #FA8589\">"); break; } }
public override void EndMarkup(DocumentMarkupKind markupKind) { dynamic end = sel.End; dynamic start = this.markupStack[this.markupStack.Count - 1]; this.markupStack.RemoveAt(this.markupStack.Count - 1); dynamic range = doc.Range(start, end); sel.TypeText(" "); dynamic afterrange = doc.Range(end, end+1); switch (markupKind) { case DocumentMarkupKind.Bold: range.Font.Bold = true; afterrange.Font.Bold = false; break; case DocumentMarkupKind.Emphasis: range.Font.Italic = true; afterrange.Font.Italic = false; break; case DocumentMarkupKind.Small: range.Font.Name = "Courier New"; range.Font.Size = this.normalStyle.Font.Size - 2; afterrange.Font.Name = normalStyle.Font.Name; afterrange.Font.Size = normalStyle.Font.Size; break; case DocumentMarkupKind.SubScript: range.Font.Subscript = true; afterrange.Font.Subscript = false; break; case DocumentMarkupKind.SuperScript: range.Font.Superscript = true; afterrange.Font.Superscript = false; break; case DocumentMarkupKind.Center: range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; break; case DocumentMarkupKind.ComputerOutput: range.Font.Name = "Courier New"; range.Font.Size = this.normalStyle.Font.Size - 2; afterrange.Font.Name = normalStyle.Font.Name; afterrange.Font.Size = normalStyle.Font.Size; break; case DocumentMarkupKind.Fail: range.Font.Shading.BackgroundPatternColor = 229 + 0x100 * 0 + 0x10000 * 50; afterrange.Font.Shading.BackgroundPatternColor = normalStyle.Font.Shading.BackgroundPatternColor; break; case DocumentMarkupKind.Success: range.Font.Shading.BackgroundPatternColor = 133 + 0x100 * 250 + 0x10000 * 133; afterrange.Font.Shading.BackgroundPatternColor = normalStyle.Font.Shading.BackgroundPatternColor; break; default: throw new DocumentException("Invalid DocumentMarkupKind: " + markupKind); } sel.delete(WdUnits.wdCharacter, 1); }
//! Begin Markup. /*! Store the starting position of the markup, so it can be used in the ending. */ public override void BeginMarkup(DocumentMarkupKind markupKind) { this.markupStack.Add(sel.Start); }
public override void EndMarkup(DocumentMarkupKind markupKind) { switch (markupKind) { case DocumentMarkupKind.Bold: writer.Write("'''"); break; case DocumentMarkupKind.ComputerOutput: writer.Write("</pre>"); break; case DocumentMarkupKind.Emphasis: writer.Write("''"); break; case DocumentMarkupKind.Center: writer.Write("</center>"); break; case DocumentMarkupKind.Success: case DocumentMarkupKind.Fail: writer.Write(" </span>"); break; } }
public abstract void BeginMarkup(DocumentMarkupKind markupKind);
public abstract void EndMarkup(DocumentMarkupKind markupKind);
public override void EndMarkup(DocumentMarkupKind markupKind) { writer.Write("}"); }
public override void BeginMarkup(DocumentMarkupKind markupKind) { switch (markupKind) { case DocumentMarkupKind.Bold: pageWriter.RenderBeginTag(HtmlTextWriterTag.B); break; case DocumentMarkupKind.Emphasis: pageWriter.RenderBeginTag(HtmlTextWriterTag.I); break; case DocumentMarkupKind.Small: pageWriter.RenderBeginTag(HtmlTextWriterTag.Small); break; case DocumentMarkupKind.SubScript: pageWriter.RenderBeginTag(HtmlTextWriterTag.Sub); break; case DocumentMarkupKind.SuperScript: pageWriter.RenderBeginTag(HtmlTextWriterTag.Sup); break; case DocumentMarkupKind.Center: pageWriter.AddAttribute(HtmlTextWriterAttribute.Class, "center"); pageWriter.RenderBeginTag(HtmlTextWriterTag.Div); break; case DocumentMarkupKind.Preformatted: pageWriter.RenderBeginTag(HtmlTextWriterTag.Pre); break; case DocumentMarkupKind.Fail: pageWriter.AddAttribute(HtmlTextWriterAttribute.Style, "background - color:#FA8589;"); pageWriter.RenderBeginTag(HtmlTextWriterTag.Span); break; case DocumentMarkupKind.Success: pageWriter.AddAttribute(HtmlTextWriterAttribute.Style, "background - color:#85FA99;"); pageWriter.RenderBeginTag(HtmlTextWriterTag.Span); break; default: throw new DocumentException("Invalid DocumentMarkupKind: " + markupKind); } }
public override void EndMarkup(DocumentMarkupKind markupKind) { switch (markupKind) { case DocumentMarkupKind.Bold: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Emphasis: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Small: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.SubScript: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.SuperScript: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Center: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Preformatted: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Fail: pageWriter.RenderEndTag(); break; case DocumentMarkupKind.Success: pageWriter.RenderEndTag(); break; default: throw new DocumentException("Invalid DocumentMarkupKind: " + markupKind); } }