比如在richedit中load一个rtf文件,
修改后再保存。我查了以前的帖子,
有个richedit.loadfromfile
但是没有这个函数啊!请指点一下,
文件编辑如何操作。
谢谢!

解决方案 »

  1.   

    procedure TForm1.FormCreate(Sender: TObject);const
      // you may need to change this path to suit your environment
      Path = '..\Demos\RichEdit\OverView.RTF';
    begin
      RichEdit1.PlainText := True;
      RichEdit1.Lines.LoadFromFile(Path);
      RichEdit2.PlainText := False;
      RichEdit2.Lines.LoadFromFile(Path);
    end;
      

  2.   

    procedure TForm1.BitBtn1Click(Sender: TObject);begin
    with PrintDialog1 do
      begin
      Options := [poPrintToFile];
      PrintToFile := True;
      if Execute then
        begin
        if PrintToFile then
          begin
          SaveDialog1.Title := 'Print to File: ';
          if SaveDialog1.Execute then
            RichEdit1.Lines.SaveToFile(SaveDialog1.FileName);
          end
        else
          RichEdit1.Print('');
        end;  end;end;
      

  3.   

    呵呵!
    我也实现了!
    多谢!很奇怪,
    不知道早上使用richedit1.lines.loadfromfile的时候会报错。
    我是用opendialog选定文件的,
    结果读入的时候报错了。
    是不是因为我加上了readonly造成的?