RTF Document
This type is the root of RTF Dom tree structure
Inheritance: RTFDomElement
        private void btnLoadClipboardRTF_Click(object sender, EventArgs e)
        {
            IDataObject ido = Clipboard.GetDataObject();
            if (ido.GetDataPresent(DataFormats.Rtf))
            {
                string rtf = ( string ) ido.GetData(DataFormats.Rtf);
                RTFDomDocument doc = new RTFDomDocument();
                doc.Progress +=new ProgressEventHandler(doc_Progress);
                doc.LoadRTFText(rtf);
                txtRTFDom.Text = doc.ToDomString();
                this.Text = "";
                myProgress.Value = 0;

            }
        }
Exemple #2
0
 private void btnLoadRTF_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter          = "*.RTF|*.rtf";
         dlg.CheckFileExists = true;
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             this.Update();
             RtfDomParser.RTFDomDocument doc = new RtfDomParser.RTFDomDocument();
             doc.Progress += new ProgressEventHandler(doc_Progress);
             doc.Load(dlg.FileName);
             txtRTFDom.Text   = doc.ToDomString();
             this.Text        = dlg.FileName;
             myProgress.Value = 0;
         }
     }
 }
 /// <summary>
 /// initialize instance
 /// </summary>
 /// <param name="doc">owner document</param>
 public RTFTextContainer(RTFDomDocument doc)
 {
     Level = 0;
     Document = doc;
 }
 /// <summary>
 /// initialize instance
 /// </summary>
 /// <param name="doc">owner document</param>
 public RTFTextContainer(RTFDomDocument doc)
 {
     myDocument = doc;
 }
 private void btnLoadRTF_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "*.RTF|*.rtf";
         dlg.CheckFileExists = true;
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             this.Update();
             RtfDomParser.RTFDomDocument doc = new RtfDomParser.RTFDomDocument();
             doc.Progress += new ProgressEventHandler(doc_Progress);
             doc.Load(dlg.FileName);
             txtRTFDom.Text = doc.ToDomString();
             this.Text = dlg.FileName;
             myProgress.Value = 0;
         }
     }
 }