Пример #1
0
        private void _btRead_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = GetFileFilter();
            dlg.FilterIndex      = 0;
            dlg.RestoreDirectory = true;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // create document
            C1WordDocument c1Word = new C1WordDocument();

            _statusBar.Text = "Loading RTF document...";
            c1Word.Load(dlg.FileName);

            _statusBar.Text = "Saving document...";
            string fileName = GetFileName(c1Word, "reading.rtf");

            c1Word.Save(fileName);
            Process.Start(fileName);
            _statusBar.Text = "Ready.";
        }
Пример #2
0
        private void _btRead_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = GetFileFilter();
            dlg.FilterIndex      = 0;
            dlg.RestoreDirectory = true;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // create document
            C1WordDocument c1Word = new C1WordDocument();

            _statusBar.Text = "Loading RTF document...";
            c1Word.Load(dlg.FileName);
#if DEBUGx
            foreach (RtfObject obj in c1Word.MainSection.Content)
            {
                if (obj is RtfParagraph)
                {
                    var paragraph = obj as RtfParagraph;
                    foreach (var o in paragraph.Content)
                    {
                        if (o is RtfString)
                        {
                            ((RtfString)o).Text = "<skip>";
                        }
                    }
                }
            }
#endif
            _statusBar.Text = "Saving document...";
            string fileName = GetFileName(c1Word, "reading.rtf");
            c1Word.Save(fileName);
            Process.Start(fileName);
            _statusBar.Text = "Ready.";
        }