Exemplo n.º 1
0
        /// <summary>
        /// Test generate rtf file
        /// after execute this function you can open c:\a.rtf
        /// </summary>
        internal static void TestWriteFile( )
        {
            RTFWriter w = new RTFWriter("c:\\a.rtf");

            TestBuildRTF(w);
            w.Close();
            System.Windows.Forms.MessageBox.Show("OK , you can open file c:\\a.rtf 了.");
        }
Exemplo n.º 2
0
 /// <summary>
 /// save rtf file
 /// </summary>
 /// <param name="strFileName">file name</param>
 public void Save(string strFileName)
 {
     using (RTFWriter writer = new RTFWriter(strFileName))
     {
         this.Write(writer);
         writer.Close();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Save rtf to a stream
 /// </summary>
 /// <param name="stream">stream</param>
 public void Save(System.IO.Stream stream)
 {
     using (RTFWriter writer = new RTFWriter(new System.IO.StreamWriter(stream, this.Encoding)))
     {
         this.Write(writer);
         writer.Close();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Test generate rtf text and copy to windows clipboard
        /// after execute this function , you can paste rtf text in MS Word
        /// </summary>
        internal static void TestClipboard()
        {
            System.IO.StringWriter myStr = new System.IO.StringWriter();
            RTFWriter w = new RTFWriter(myStr);

            TestBuildRTF(w);
            w.Close();
            System.Windows.Forms.DataObject data = new System.Windows.Forms.DataObject();
            data.SetData(System.Windows.Forms.DataFormats.Rtf, myStr.ToString());
            System.Windows.Forms.Clipboard.SetDataObject(data, true);
            System.Windows.Forms.MessageBox.Show("OK, you can paste words in MS Word.");
        }
Exemplo n.º 5
0
        /// <summary>
        /// test
        /// </summary>
        internal static void Test()
        {
            RTFRawDocument doc = new RTFRawDocument();

            doc.Load(@"d:\abc.rtf");
            //System.Console.WriteLine( doc.Text );
            RTFWriter writer = new RTFWriter(@"d:\a.rtf");

            writer.Indent = true;
            doc.Write(writer);
            writer.Close();
        }