/// <summary> /// Write /// </summary> /// <param name="writer"></param> public void Write(Writer writer) { writer.WriteStartGroup(); writer.WriteKeyword(Consts.Colortbl); writer.WriteRaw(";"); foreach (var item in _arrayList) { var c = (Color) item; writer.WriteKeyword("red" + c.R); writer.WriteKeyword("green" + c.G); writer.WriteKeyword("blue" + c.B); writer.WriteRaw(";"); } writer.WriteEndGroup(); }
/// <summary> /// Write font table rtf /// </summary> /// <param name="writer">rtf text writer</param> public void Write(Writer writer) { writer.WriteStartGroup(); writer.WriteKeyword(Consts.Fonttbl); foreach (Font font in this) { writer.WriteStartGroup(); writer.WriteKeyword("f" + font.Index); if (font.Charset != 0) { writer.WriteKeyword("fcharset" + font.Charset); } writer.WriteText(font.Name); writer.WriteEndGroup(); } writer.WriteEndGroup(); }
// ReSharper disable MemberCanBeProtected.Global /// <summary> /// Open Rtf file from a textwriter /// </summary> /// <param name="writer"></param> public void Open(TextWriter writer) { Writer = new Writer(writer) {Indent = false}; }
/// <summary> /// Open Rtf file from a file /// </summary> /// <param name="fileName"></param> public void Open(string fileName) { Writer = new Writer(fileName) {Indent = false}; }
public void Write(Writer writer) { writer.WriteStartGroup(); writer.WriteKeyword("info"); foreach (string strKey in _infoStringDictionary.Keys) { writer.WriteStartGroup(); if (strKey == "edmins" || strKey == "vern" || strKey == "nofpages" || strKey == "nofwords" || strKey == "nofchars" || strKey == "nofcharsws" || strKey == "id") { writer.WriteKeyword(strKey + _infoStringDictionary[strKey]); } else { writer.WriteKeyword(strKey); writer.WriteText(_infoStringDictionary[strKey]); } writer.WriteEndGroup(); } writer.WriteStartGroup(); WriteTime(writer, "creatim", _creationTime); WriteTime(writer, "revtim", _revisionTime); WriteTime(writer, "printim", _printTime); WriteTime(writer, "buptim", _backupTime); writer.WriteEndGroup(); }
private void WriteTime(Writer writer, string name, DateTime value) { writer.WriteStartGroup(); writer.WriteKeyword(name); writer.WriteKeyword("yr" + value.Year); writer.WriteKeyword("mo" + value.Month); writer.WriteKeyword("dy" + value.Day); writer.WriteKeyword("hr" + value.Hour); writer.WriteKeyword("min" + value.Minute); writer.WriteKeyword("sec" + value.Second); writer.WriteEndGroup(); }
/// <summary> /// Write rtf /// </summary> /// <param name="writer">RTF writer</param> public override void Write(Writer writer) { writer.Encoding = Encoding; base.Write(writer); }
/// <summary> /// Save rtf to a stream /// </summary> /// <param name="stream">stream</param> public void Save(Stream stream) { using (var writer = new Writer(new StreamWriter(stream, Encoding))) Write(writer); }
/// <summary> /// Save rtf to a file /// </summary> /// <param name="fileName">file name</param> public void Save(string fileName) { using (var writer = new Writer(fileName)) Write(writer); }
/// <summary> /// Write content to rtf document /// </summary> /// <param name="writer">RTF text writer</param> public override void Write(Writer writer) { writer.WriteStartGroup(); foreach (Node node in InternalNodes) node.Write(writer); writer.WriteEndGroup(); }