Это все в составе навороченного класса дизайнера. Выдрал рутинку, которая выводит в rtf, может, поможет чем.
Код: Выделить всё
outRTF_r  routine   !вывод в rtf
   DATA
lor:date   long
lor:clock  long
lor:korX2  real
lor:korY2  real
lor:korL   real
lor:h      real
lor:queueFonts queue, pre()
lor:font  string(32)
  end
lor:queueColors queue, pre()
lor:color  long
  end
lor:j          long
lor:f          string(3)
lor:colorFont  string(32)
lor:colorBgr   string(32)
lor:colorLine  string(32)
lor:colorWhite string(32)
lor:colorTmp   long
lor:colorInb   byte,DIM(4),OVER(lor:colorTmp)
   CODE
   if SELF.FlagRTF=0
      loc:err=7
      exit
   end
   if SELF.FileNameRTF=''
      loc:err=7
      exit
   end 
   if sub(lower(SELF.FileNameRTF),len(clip(SELF.FileNameRTF))-3,4)<>'.rtf'
      SELF.FileNameRTF=clip(SELF.FileNameRTF) & '.rtf'
   end 
   if exists(SELF.FileNameRTF)
      remove(SELF.FileNameRTF)
   end
   ASCIIFile{PROP:NAME}=SELF.FileNameRTF
   create(ASCIIFile)
   open(ASCIIFile)
   if error()
      loc:err=8
      exit
   end
   lor:date=today()
   lor:clock=clock()
   SELF.SetKoeff(1)   !тест
   loop loc:i=1 to records(SELF.DrawButtonsRTF)
      get(SELF.DrawButtonsRTF,loc:i)
      if SELF.DrawButtonsRTF.ButtonFontName<>''
         lor:font=SELF.DrawButtonsRTF.ButtonFontName
         get(lor:queueFonts,lor:font)
         if error()
            add(lor:queueFonts,lor:font)
         end
      end
      if SELF.DrawButtonsRTF.ButtonFontColor>0
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonFontColor
         get(lor:queueColors,lor:color)
         if error()
            add(lor:queueColors,lor:color)
         end
      end
      if SELF.DrawButtonsRTF.ButtonBackGround>0 and SELF.DrawButtonsRTF.ButtonFlagBackGround=1
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonBackGround
         get(lor:queueColors,lor:color)
         if error()
            add(lor:queueColors,lor:color)
         end
      end
      if SELF.DrawButtonsRTF.ButtonBorderColor>0
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonBorderColor
         get(lor:queueColors,lor:color)
         if error()
            add(lor:queueColors,lor:color)
         end
      end
   end
   arf:rec='{{\rtf1\ansi\deff0'
   add(ASCIIFile)
   arf:rec='{{\fonttbl{{\f0\fcharset204 Arial;}'
   if records(lor:queueFonts)>0
      loop lor:j=1 to records(lor:queueFonts)
         get(lor:queueFonts,lor:j)
         arf:rec=clip(arf:rec) & '{{\f' & lor:j & '\fcharset204 ' & clip(lor:font) & ';}'
      end
   end
   arf:rec=clip(arf:rec) & '}'
   add(ASCIIFile)
   arf:rec='{{\colortbl \red0\green0\blue0;'
   if records(lor:queueColors)>0
      loop lor:j=1 to records(lor:queueColors)
         get(lor:queueColors,lor:j)
         lor:colorTmp=lor:color
         arf:rec=clip(arf:rec) & '\red' & lor:colorInb[1] & '\green' & lor:colorInb[2] & '\blue' & lor:colorInb[3] & ';'
      end
   end
   lor:colorTmp=COLOR:White
   arf:rec=clip(arf:rec) & '\red' & lor:colorInb[1] & '\green' & lor:colorInb[2] & '\blue' & lor:colorInb[3] & ';'
   lor:colorWhite='\brdrcf' & records(lor:queueColors)+1   !белые границы для скрытия рамки
   arf:rec=clip(arf:rec) & '}'
   add(ASCIIFile)
   arf:rec='{{\info{{\title ' & clip(SELF.ReportComment) & '}{{\author ФинСофт:Дизайнер бланков}' & |
           '{{\creatim\yr' & year(lor:date) & '\mo' & format(month(lor:date),@n02) & '\dy' & format(day(lor:date),@n02) & |
           '\hr' & sub(format(lor:clock,@t01),1,2) & '\min' & sub(format(lor:clock,@t01),4,2) & '}' & | 
           '{{\*\windowcaption ' & clip(SELF.ReportComment) & '}}'
   add(ASCIIFile)
   if SELF.ReportPaperNoStd=0
      if SELF.ReportFlagLand=0
         arf:rec='\paperw' & (round(8252*1445.4/1000,1)) & '\paperh' & (round(11688*1445.4/1000,1)) & '\margl' & round(SELF.ReportMargLeft*567/10,1) & '\margr' & round(SELF.ReportMargRight*567/10,1) & '\margt' & round(SELF.ReportMargTop*567/10,1) & '\margb' & round(SELF.ReportMargBottom*567/10,1) & '\sectd\psz256\viewkind1\viewscale100\viewzk0'
      else
         arf:rec='\paperw' & (round(11688*1445.4/1000,1)) & '\paperh' & (round(8252*1445.4/1000,1)) & '\margl' & round(SELF.ReportMargLeft*567/10,1) & '\margr' & round(SELF.ReportMargRight*567/10,1) & '\margt' & round(SELF.ReportMargTop*567/10,1) & '\margb' & round(SELF.ReportMargBottom*567/10,1) & '\sectd\psz256\viewkind1\viewscale100\viewzk0\landscape'
      end
   else
      if SELF.ReportFlagLand=0
         arf:rec='\paperw' & (round(8252/210*SELF.ReportPaperWidth*1445.4/1000,1)) & '\paperh' & (round(8252/210*SELF.ReportPaperHeight*1445.4/1000,1)) & '\margl' & round(SELF.ReportMargLeft*567/10,1) & '\margr' & round(SELF.ReportMargRight*567/10,1) & '\margt' & round(SELF.ReportMargTop*567/10,1) & '\margb' & round(SELF.ReportMargBottom*567/10,1) & '\sectd\psz256\viewkind1\viewscale100\viewzk0'
      else
         arf:rec='\paperw' & (round(8252/210*SELF.ReportPaperHeight*1445.4/1000,1)) & '\paperh' & (round(8252/210*SELF.ReportPaperWidth*1445.4/1000,1)) & '\margl' & round(SELF.ReportMargLeft*567/10,1) & '\margr' & round(SELF.ReportMargRight*567/10,1) & '\margt' & round(SELF.ReportMargTop*567/10,1) & '\margb' & round(SELF.ReportMargBottom*567/10,1) & '\sectd\psz256\viewkind1\viewscale100\viewzk0\landscape'
      end
   end
   add(ASCIIFile)
   loop loc:i=1 to records(SELF.DrawButtonsRTF)
      get(SELF.DrawButtonsRTF,loc:i)
      if SELF.DrawButtonsRTF.ButtonID=-1 and loc:i>1 
        arf:rec='\par\pard\plain'
        add(ASCIIFile)
        arf:rec='\par\page'
        add(ASCIIFile)
        cycle
      end 
      if SELF.DrawButtonsRTF.ButtonFontName=''
         lor:f='\f0'
      else
         lor:font=SELF.DrawButtonsRTF.ButtonFontName
         get(lor:queueFonts,lor:font)
         lor:f='\f' & pointer(lor:queueFonts)
      end
      lor:colorFont=''
      lor:colorBgr=''
      lor:colorLine=''
      if SELF.DrawButtonsRTF.ButtonBackGround>0 and SELF.DrawButtonsRTF.ButtonFlagBackGround=1
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonBackGround
         get(lor:queueColors,lor:color)
         lor:colorBgr='\cbpat' & pointer(lor:queueColors)
      end
      if SELF.DrawButtonsRTF.ButtonBorderColor>0
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonBorderColor
         get(lor:queueColors,lor:color)
         lor:colorLine='\brdrcf' & pointer(lor:queueColors)
      end
      if SELF.DrawButtonsRTF.ButtonFontColor>0
         clear(lor:queueColors)
         lor:color=SELF.DrawButtonsRTF.ButtonFontColor
         get(lor:queueColors,lor:color)
         lor:colorFont='\cf' & pointer(lor:queueColors)
      end
      if SELF.DrawButtonsRTF.ButtonType=0   !текст
         arf:rec='\par\pard\plain'
         if band(SELF.DrawButtonsRTF.ButtonFontStyle,FONT:bold)=700 
            arf:rec=clip(arf:rec) & '\b'
         end
         if band(SELF.DrawButtonsRTF.ButtonFontStyle,FONT:italic)>0 
            arf:rec=clip(arf:rec) & '\i'
         end
         if band(SELF.DrawButtonsRTF.ButtonFontStyle,FONT:underline)>0 
            arf:rec=clip(arf:rec) & '\ul'
         end
         if band(SELF.DrawButtonsRTF.ButtonFontStyle,FONT:strikeout)>0 
            arf:rec=clip(arf:rec) & '\strike'
         end
         arf:rec=clip(arf:rec) & lor:colorFont
         case SELF.DrawButtonsRTF.ButtonTextJust
            of 0   !влево
               arf:rec=clip(arf:rec) & '\ql'
            of 1   !вправо
               arf:rec=clip(arf:rec) & '\qr'
            of 2   !центр
               arf:rec=clip(arf:rec) & '\qc'
         end 
         if SELF.PrgViewRTF=0   !MCO
            SELF.DrawButtonsRTF.ButtonPadLeft=2   !делаем стандартные отступы, что избежать погрешностей????
            SELF.DrawButtonsRTF.ButtonPadRight=2
         end 
         if SELF.DrawButtonsRTF.ButtonLineW>1  !корректировка поля отступа для жирных линий
            lor:korL=10
         else
            lor:korL=0
         end
         if SELF.DrawButtonsRTF.ButtonLeft=1
            arf:rec=clip(arf:rec) & '\brdrl\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorLine) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadLeft*SELF.ReportKoefX*10-lor:korL,1)
         else
            arf:rec=clip(arf:rec) & '\brdrl\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorWhite) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadLeft*SELF.ReportKoefX*10,1)
         end
         if SELF.DrawButtonsRTF.ButtonRight=1
            arf:rec=clip(arf:rec) & '\brdrr\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorLine) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadRight*SELF.ReportKoefX*10-lor:korL,1)
         else
            arf:rec=clip(arf:rec) & '\brdrr\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorWhite) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadRight*SELF.ReportKoefX*10,1)
         end
         if SELF.DrawButtonsRTF.ButtonTop=1
            arf:rec=clip(arf:rec) & '\brdrt\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10+10,1) & clip(lor:colorLine) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadTop*SELF.ReportKoefY-lor:korL,1)
         else
            arf:rec=clip(arf:rec) & '\brdrt\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorWhite) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadTop*SELF.ReportKoefY,1)
         end
         if SELF.DrawButtonsRTF.ButtonBottom=1
            arf:rec=clip(arf:rec) & '\brdrb\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10+10,1) & clip(lor:colorLine) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadBottom*SELF.ReportKoefY-lor:korL,1)
         else
            arf:rec=clip(arf:rec) & '\brdrb\brdrs\brdrw' & round(choose(SELF.DrawButtonsRTF.ButtonLineW=0,1,SELF.DrawButtonsRTF.ButtonLineW)*10,1) & clip(lor:colorWhite) & '\brsp' & round(SELF.DrawButtonsRTF.ButtonPadBottom*SELF.ReportKoefY,1) 
         end
         if SELF.PrgViewRTF=0   !MCO
             lor:korX2=(SELF.DrawButtonsRTF.ButtonPadLeft+SELF.DrawButtonsRTF.ButtonPadRight)*SELF.ReportKoefX*10+36            
             lor:korY2=-15.75 
             lor:h=round(SELF.DrawButtonsRTF.ButtonY2*SELF.ReportKoefY-lor:kory2,1)
         else                   !OO 
             lor:korX2=-2
             lor:kory2=-20
             lor:h=round(SELF.DrawButtonsRTF.ButtonY2*SELF.ReportKoefY-lor:kory2,1)
         end
         
         arf:rec=clip(arf:rec) & '\phmrg\pvmrg\posx' & round(SELF.DrawButtonsRTF.ButtonX1*SELF.ReportKoefX,1) & |
              '\posy' & round(SELF.DrawButtonsRTF.ButtonY1*SELF.ReportKoefY,1) & '\absw' & round(SELF.DrawButtonsRTF.ButtonX2*SELF.ReportKoefX-lor:korX2,1) & '\absh' & choose(SELF.DrawButtonsRTF.ButtonTextResize=0,'-','-') & lor:h & |
              '\overlay' & clip(lor:colorBgr) & clip(lor:f) & '\fs' & round(SELF.DrawButtonsRTF.ButtonFontSize*2,1) & '{{' & clip(SELF.StrReplace(SELF.DrawButtonsRTF.ButtonText,chr(13) & chr(10),'\line')) & '}'
         add(ASCIIFile)
      else    !картинка
         arf:rec='\par\pard\phmrg\pvmrg'
         arf:rec=clip(arf:rec) & '\posx' & round(SELF.DrawButtonsRTF.ButtonX1*SELF.ReportKoefX,1) & |
              '\posy' & round(SELF.DrawButtonsRTF.ButtonY1*SELF.ReportKoefY,1) & '\overlay' & clip(lor:colorBgr) & clip(lor:f) & '\fs' & round(SELF.DrawButtonsRTF.ButtonFontSize*2,1) & |
              '{{{{\pict\wmetafile8\picwgoal' & round(SELF.DrawButtonsRTF.ButtonX2*SELF.ReportKoefX,1) & '\pichgoal' & round(SELF.DrawButtonsRTF.ButtonY2*SELF.ReportKoefY,1) 
         add(ASCIIFile)
         loop loc:j=1 to records(SELF.DrawPictRTF)
            get(SELF.DrawPictRTF,loc:j)
            if SELF.DrawPictRTF.PictName=SELF.DrawButtonsRTF.ButtonText
               loop loc:j=SELF.DrawPictRTF.PictNumStart to SELF.DrawPictRTF.PictNumEnd
                  get(SELF.DrawPictDetRTF,loc:j)
                  arf:rec=SELF.DrawPictDetRTF.PictDetStr
                  add(ASCIIFile)
               end
               break 
            end
         end   
         arf:rec='}}'
         add(ASCIIFile)
     end
   end
   ! \par  - конец абзаца
   ! \pard - стандартная настройка абзаца
   ! \ql, \qr, \qc - выравнивание по левому, правому краю или центру
   ! \brdrt, \brdrb, \brdrl, \brdrr - рамки сверху, снизу, слева, справа
   ! \brspn - расстояние в twips между рамкой и объектом
   ! \brdrs - простая рамка
   ! \brdrwn - толщина границы
   ! \posxn, \posyn - расстояния слева и сверху для объекта в twips
   ! \pvmgr, \phmgr - позиция по вертикали и горизонтали относительно полей
   ! \ul - установка подчеркивания текста (параметр 0 для отмены)
   ! \plain - установить стандартные параметры форматирования
   ! \b - жирный шрифт
   ! \i - курсив
   ! \strike - зачеркнутый текст
   ! \page - переход на новую страницу
   ! \fs - размер шрифта
   ! \fn - номер фонта    
   ! \overlay - текст внутри фрейма
   ! \linN - отступ слева для параграфа 
   ! \piccroprN - добавляет отступ в twips вокруг картинки, если N<0
   ! \piccropbN - добавляет границу в twips вокруг картинки, если N<0
   !для теста ---
   !arf:rec='\par\pard\plain\b\ul\ql\lin33\phmrg\pvmrg\posx0\posy0\absw8352\absh-290\overlay\f0\fs28{{Список сотрудников}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\b\ql\lin31\phmrg\pvmrg\posx0\posy435\absw2523\absh-290\overlay\f0\fs20{{30/10/2013}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\b\qc\brdrt\brdrs\brdrw10\brsp0\brdrb\brdrs\brdrw10\brsp0\brdrl\brdrs\brdrw10\brsp0\brdrr\brdrs\brdrw10\brsp0\phmrg\pvmrg\posx35\posy836\absw974\absh-300\overlay\f0\fs20{{Код}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\b\ql\brdrt\brdrs\brdrw10\brsp0\brdrb\brdrs\brdrw10\brsp0\brdrl\brdrs\brdrw10\brsp0\brdrr\brdrs\brdrw10\brsp0\phmrg\pvmrg\posx1079\posy836\absw5788\absh-300\overlay\f0\fs20{{ФИО}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\b\ql\lin31\phmrg\pvmrg\posx0\posy1131\absw6931\absh-290\overlay\f0\fs20{{скл2}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\qc\brdrt\brdrs\brdrw10\brsp0\brdrb\brdrs\brdrw10\brsp0\brdrl\brdrs\brdrw10\brsp0\brdrr\brdrs\brdrw10\brsp0\phmrg\pvmrg\posx35\posy1416\absw974\absh-300\overlay\f0\fs20{{     7}'
   !add(ASCIIFile)
   !arf:rec='\par\pard\plain\ql\brdrt\brdrs\brdrw10\brsp0\brdrb\brdrs\brdrw10\brsp0\brdrl\brdrs\brdrw10\brsp0\brdrr\brdrs\brdrw10\brsp0\phmrg\pvmrg\posx1079\posy1416\absw5788\absh-300\overlay\f0\fs20{{Алексухин Константин Александрович}'
   !add(ASCIIFile)
   ! --
   arf:rec='\par }'
   add(ASCIIFile)
   close(ASCIIFile)
   free(lor:queueFonts)
   free(lor:queueColors)