New: Print/Display RichText

Post Reply
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

New: Print/Display RichText

Post by nageswaragunupudi »

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: Select all | Expand


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: Select all | Expand


#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.

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

Display RichText in any rectangular area of a window/dialog/control, by using the same method oWnd:SayText( cRichText, aRect )

Code: Select all | Expand


   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
      >
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
cmsoft
Posts: 1297
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Been thanked: 2 times

Re: New: Print/Display RichText

Post by cmsoft »

Excelente!!! Muy buen aporte!
Felicitaciones!
User avatar
TimStone
Posts: 2956
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: New: Print/Display RichText

Post by TimStone »

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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

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
User avatar
Silvio.Falconi
Posts: 7164
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 2 times

Re: New: Print/Display RichText

Post by Silvio.Falconi »

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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

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

G. N. Rao.
Hyderabad, India
User avatar
Detlef
Posts: 209
Joined: Mon Feb 07, 2022 9:54 pm

Re: New: Print/Display RichText

Post by Detlef »

That's great news.
Many thanks for this excellent development.
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

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: Select all | Expand

#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

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


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
cmsoft
Posts: 1297
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Been thanked: 2 times

Re: New: Print/Display RichText

Post by cmsoft »

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=6&t=41905&start=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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: New: Print/Display RichText

Post by nageswaragunupudi »

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
Post Reply