在C#中如何将多个rtf文件内容组合在一起用一个rtf文件保存?

        //重点为是使用 SelectedRtf  属性
        private void button1_Click( object sender, EventArgs e )
        {
            //mergeRTF为并内容后的 RichTextBox 控件
            mergeRTF.SelectionLength = 0;       //不选内容


            RichTextBox rtf = new RichTextBox();        //需要合并的RTF
            StringBuilder s = new StringBuilder();

            //第一个RTF文件
            rtf.Text = "C#程序设计";
            rtf.SelectAll();

            Font f = null;
            f = new Font( "宋体", 12 ,FontStyle.Bold);

            rtf.SelectionFont = f;      //字体
            rtf.SelectionColor = Color.Red;

            //加入
            mergeRTF.SelectedRtf = rtf.SelectedRtf;

            //第二个RTF文件
            rtf.Text = "VB.NET程序设计";
            rtf.SelectAll();

            f = new Font( "楷体", 10, FontStyle.Italic );

            rtf.SelectionFont = f;      //字体
            rtf.SelectionColor = Color.Gray;

            //加入
            mergeRTF.SelectedRtf = rtf.SelectedRtf;

            //第三个RTF文件
            rtf.Text = "美利坚合众国";
            rtf.SelectAll();

            f = new Font( "黑体", 25, FontStyle.Underline | FontStyle.Bold | FontStyle.Italic );

            rtf.SelectionFont = f;      //字体
            rtf.SelectionColor = Color.Blue;

            //加入
            mergeRTF.SelectedRtf = rtf.SelectedRtf;

            //第N个
            //。。。。



        }

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值