Exemplo n.º 1
0
 /// <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();
 }
Exemplo n.º 2
0
 /// <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();
 }
Exemplo n.º 3
0
 // 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};
 }
Exemplo n.º 4
0
 /// <summary>
 /// Open Rtf file from a file
 /// </summary>
 /// <param name="fileName"></param>
 public void Open(string fileName)
 {
     Writer = new Writer(fileName) {Indent = false};
 }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Write rtf
 /// </summary>
 /// <param name="writer">RTF writer</param>
 public override void Write(Writer writer)
 {
     writer.Encoding = Encoding;
     base.Write(writer);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Write rtf
 /// </summary>
 /// <param name="writer">RTF writer</param>
 public override void Write(Writer writer)
 {
     writer.Encoding = Encoding;
     base.Write(writer);
 }
Exemplo n.º 9
0
 /// <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);
 }
Exemplo n.º 10
0
 /// <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);
 }
Exemplo n.º 11
0
        /// <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();
        }