New: Print/Display RichText

New: Print/Display RichText

Postby nageswaragunupudi » Fri Mar 25, 2022 3: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: Select all  Expand view

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 view

#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: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby nageswaragunupudi » Fri Mar 25, 2022 3:33 am

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

   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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby cmsoft » Fri Mar 25, 2022 9:36 pm

Excelente!!! Muy buen aporte!
Felicitaciones!
User avatar
cmsoft
 
Posts: 1285
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: New: Print/Display RichText

Postby TimStone » Mon Mar 28, 2022 7: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
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: New: Print/Display RichText

Postby nageswaragunupudi » Tue Mar 29, 2022 4: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby Silvio.Falconi » Tue Mar 29, 2022 8: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 November 2023 - January 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
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: New: Print/Display RichText

Postby nageswaragunupudi » Mon Jun 20, 2022 5: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby nageswaragunupudi » Mon Jun 20, 2022 5:38 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby Detlef » Mon Jun 20, 2022 6:12 am

That's great news.
Many thanks for this excellent development.
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: New: Print/Display RichText

Postby nageswaragunupudi » Fri Jul 01, 2022 5: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: Select all  Expand view
#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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Print/Display RichText

Postby cmsoft » 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=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
cmsoft
 
Posts: 1285
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: New: Print/Display RichText

Postby nageswaragunupudi » Sat Jul 02, 2022 5: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 56 guests