Example #1
0
        public static void SaveRTFFile(
            TextWriter writer,
            DomDocument document)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }
            RTFContentWriter RTFwriter = new RTFContentWriter(writer);

            RTFwriter.Document             = document;
            RTFwriter.IncludeSelectionOnly = false;
            RTFwriter.WriteAllDocument();
            writer.Close();
        }
Example #2
0
 public static void SaveRTFFile(string fileName, DomDocument document)
 {
     if (fileName == null)
     {
         throw new ArgumentNullException("fileName");
     }
     if (document == null)
     {
         throw new ArgumentNullException("document");
     }
     using (StreamWriter writer = new StreamWriter(
                fileName,
                false,
                Encoding.Default))
     {
         RTFContentWriter RTFwriter = new RTFContentWriter(writer);
         RTFwriter.Document             = document;
         RTFwriter.IncludeSelectionOnly = false;
         RTFwriter.WriteAllDocument();
         writer.Close();
     }
 }