FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New: Print/Display RichText
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
New: Print/Display RichText
Posted: Fri Mar 25, 2022 03:27 AM
From the next version onwards, the same methods/commands which we have been using all along for display/print multi-line text, will display/print RichText also, without any additional coding by the programmer.
Code (fw): Select all Collapse
oWnd:SayText( cText, aRect, ... )
oPrn:SayText( cText, aRect, ... )
@ r,c PRINT TO oPrn TEXT cText SIZE w,h INCHES/CM/MM


samples\rtfprn.prg
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oPrn, cText, cRtf, oFont, oBold

   cText := MEMOREAD( "rtfprn.prg" )
   cRtf  := MEMOREAD( "testrtf.rtf" )

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "LUCIDA CONSOLE" SIZE 0,-10 OF oPrn
   DEFINE FONT oBold NAME "ARIAL" SIZE 0,-20 OF oPrn

   PAGE

      oPrn:Say( 0.5, 0.8, "Rich Text", oBold,,,,, "INCHES" )
      oPrn:Box( 0.8, 0.8, 5.2, 7.2,,,, "INCHES" )
      @ 1, 1 PRINT TO oPrn TEXT cRtf  SIZE 6,4 INCHES

      oPrn:Say( 5.5, 0.8, "Normal Text", oBold,,,,, "INCHES" )
      oPrn:Box( 5.8, 0.8, 10.2, 7.2,,,, "INCHES" )
      @ 6, 1 PRINT TO oPrn TEXT cText SIZE 6,4 INCHES FONT oFont

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont, oBold

return nil

Same syntax is used for both normal text and rich text.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Fri Mar 25, 2022 03:33 AM
Display RichText in any rectangular area of a window/dialog/control, by using the same method oWnd:SayText( cRichText, aRect )
Code (fw): Select all Collapse
   oWnd:bPainted := <|hDC|
      local oRect := oWnd:GetCliAreaRect()
      oRect += { 60, 60, -60, -60 }
      oWnd:SayText( cRtf, oRect:aRect )
      oRect += { -20, -20, 20, 20 }
      oWnd:Box( oRect:nTop, oRect:nLeft, oRect:nBottom, oRect:nRight )
      return nil
      >


Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: New: Print/Display RichText
Posted: Fri Mar 25, 2022 09:36 PM

Excelente!!! Muy buen aporte!
Felicitaciones!

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: New: Print/Display RichText
Posted: Mon Mar 28, 2022 07:02 PM

I will greatly appreciate this capability.

Will this also work automatically in PREVIEW mode ?

Do we have an ETA for the next version ?

Thanks so much for all the effort on this capability.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Tue Mar 29, 2022 04:02 AM
Will this also work automatically in PREVIEW mode ?

Yes

Do we have an ETA for the next version ?

Early April 22.
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: New: Print/Display RichText
Posted: Tue Mar 29, 2022 08:42 AM

Could you also bring in the justification of the paragraphs?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Mon Jun 20, 2022 05:38 AM
Silvio.Falconi wrote:Could you also bring in the justification of the paragraphs?

Richtext allows formatting paragraphs with justification.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Mon Jun 20, 2022 05:38 AM

From the next version it is possible to split across pages.

Regards



G. N. Rao.

Hyderabad, India
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: New: Print/Display RichText
Posted: Mon Jun 20, 2022 06:12 AM

That's great news.
Many thanks for this excellent development.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Fri Jul 01, 2022 05:51 PM
We were able to split normal text across pages. From ver 22.06, it is possible to split rich text also with the same syntax.

Sample:
Code (fw): Select all Collapse
#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oPrn, oLarg, oFont, oPen, nLastRow
   local cNotes   := HB_MEMOREAD( "c:\fwh\samples\test.rtf" )

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 OF oPrn
   DEFINE FONT oLarg NAME "TAHOMA" SIZE 0,-40 BOLD OF oPrn
   DEFINE PEN oPen WIDTH 1 OF oPrn

   PAGE

      oPrn:Box( 0.9, 0.9, 7.6, 7.1, oPen, nil, ;
         { "MAIN" + CRLF + "REPORT", oLarg }, ;
         "INCHES" )

      oPrn:Say( 7.9, 1.00, "Notes: ( Normal Text or Rich Text )", ;
         oFont, 6.0, nil, nil, nil, "INCHES" )

      @ 8.5, 1.0 PRINT TO oPrn TEXT @cNotes SIZE 6.0, 1.5 INCHES ;
         LASTROW nLastRow

      oPrn:Box( 8.40, 0.90, nLastRow + 0.1, 7.10, oPen, nil, nil, "INCHES" )

   ENDPAGE

   do while .not. Empty( cNotes )

      PAGE

      @ 1.0, 1.0 PRINT TO oPrn TEXT @cNotes SIZE 6.0, 9.0 INCHES ;
         LASTROW nLastRow

      oPrn:Box( 0.90, 0.90, nLastRow + 0.1, 7.10, oPen, nil, nil, "INCHES" )

      ENDPAGE

   enddo

   ENDPRINT

   RELEASE FONT oFont, oLarg
   RELEASE PEN oPen

return nil

//----------------------------------------------------------------------------//


Regards



G. N. Rao.

Hyderabad, India
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: New: Print/Display RichText
Posted: Fri Jul 01, 2022 10:38 PM

Excelente aporte Mr. Rao. Creo que con esto se pueden generar y combinar para hacer reportes personalizados de alta calidad!

Aprovecho para consultarle sobre algo que se consultó en este hilo:

viewtopic.php?f=6t=41905start=15
Hay alguna posibilidad que al leer un archivo .rtf tambiƩn se pueda traer el encabezado y pie de pƔgina?
Desde ya muchas gracias

&&

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: New: Print/Display RichText
Posted: Sat Jul 02, 2022 05:17 AM
Hay alguna posibilidad que al leer un archivo .rtf tambiƩn se pueda traer el encabezado y pie de pƔgina?

Need some time please.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion