我现在想实现这样一个功能,在打印的时候动态控制memo的居中,强制换行等
不知道在程序中如何实现,我用的是fastreport,调用的外部报表文件进行打印的
我想知道应该在哪个事件里面写比较好,应该怎么实现

解决方案 »

  1.   

    procedure TForm1.frReport1BeforePrint(Memo: TStringList; View: TfrView);
    begin
      if View.Name ='Memo1' then (View as TfrMemoView)...
      ...
    end;
      

  2.   

    谢谢,能不能再详细一点,比如我要让memo7设置居中,!
      

  3.   

    procedure TForm1.frReport1BeforePrint(Memo: TStringList; View: TfrView);
    begin
        if View.Name ='Memo1' then
           (View as TfrMemoview).Memo.Text :=Edit1.text;
    end;其他属性照着编辑器里边的属性修改就行了。
      

  4.   

    memo 本来就没有,要用Rich
      

  5.   

    动态居中,其实很简单,你用过word就知道,在上面的工具框,同word的一样,用鼠标放上去看一下注释就知道了。
    强行转行,用两个memo上下罗起来实现,中间去掉黑线。
      

  6.   

    可能用rich效果要好一点,楼上的这位兄弟,我要动态居中是要在程序中用代码实现,不是在编辑状态改变阿
      

  7.   

    var
      v: TfrMemoview;      v := TfrMemoview(frCreateObject(gtMemo, ''));         //创建Fields的名字
          //如果已经创建好的,可以使用frFindObject函数(可能是这个函数,我没查资料,都忘了)
          v.SetBounds(iWidth,138, pDataDict[i].iPrintWidth,28);
          v.Font.Size := 9;
          v.Memo.Add(pDataDict[i].sAliasName);//自己可以控制sAliasName字符串来强制换行
          if pDataDict[i].Alignment = taLeftJustify then v.Alignment:=0;  //字符串位置
          if pDataDict[i].Alignment = taRightJustify then v.Alignment:=1;
          if pDataDict[i].Alignment = taCenter then v.Alignment:=2;
          FRReport.Pages.Pages[0].Objects.Add(v);
      

  8.   

    谢谢上面的大哥,好复杂阿,我现在只想用richtext做了,但是不知道如何定位richtext对象了
      if view.Name='rich1' then
    (view as TfrRichView).text:='[ZBQUERY."GCMC1"],[ZBQUERY."JZMJ1"]平方米'
    这样达不到我要达到的效果
      

  9.   


     if view.Name='rich1' then
    (view as TfrRichView).richedit.text:='[ZBQUERY."GCMC1"],[ZBQUERY."JZMJ1"]平方米'
      

  10.   

    其实并不复杂,我上面都告诉你了。定位:
    v := TfrMemoView(frReport1.FindObject('Memo1'))  ;设置长宽高:
    v.SetBounds(50,138, 100,28);加入内容:
    v.Memo.Add('你要加入的字符串'+#$D#$A+'我要换行');对齐:
    if 你的对齐方式 = taLeftJustify then v.Alignment:=0;  
    if 你的对齐方式 = taRightJustify then v.Alignment:=1;
    if 你的对齐方式 = taCenter then v.Alignment:=2;