Click here to Skip to main content
12,701,051 members (29,341 online)
Click here to Skip to main content

Tagged as


100 bookmarked

RTF Document Constructor Library

, 16 Aug 2010 CPOL
Create Rich Text Format documents programatically.
using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;

using ESCommon;
using ESCommon.Rtf;

namespace RtfConstructor
    public partial class MainForm : Form
        public MainForm()

        private void button1_Click(object sender, EventArgs e)
            button1.Enabled = false;
            Report report = new Report();
            RtfDocument rtf = report.GetRtf();
            RtfWriter rtfWriter = new RtfWriter();
            DateTime start;
            TimeSpan time;

                using (TextWriter writer = new StreamWriter("test.rtf"))
                    start = DateTime.Now;

                    rtfWriter.Write(writer, rtf);

                    time = DateTime.Now - start;

                    label1.Text = String.Format("{0}.{1}", time.Seconds, time.Milliseconds.ToString().PadLeft(3, '0'));
            catch (IOException)
                label1.Text = "I/O Exception";

            button1.Enabled = true;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dima Popov
Software Developer Energoservice
Russian Federation Russian Federation
Dmitry lives in Arkhangelsk, Russia. He has developed C# applications since 2007.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 16 Aug 2010
Article Copyright 2010 by Dima Popov
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid