Print RTF using tPRINTER class ?????

Print RTF using tPRINTER class ?????

Postby TimStone » Fri Dec 10, 2021 6:15 pm

I will start this as a new thread and hopefully someone will understand the issue and have a solution:

I print an Invoice using the tPRINTER class. It is a complex document and I can NOT use the REPORT class. At the end of the document is the DISCLAIMER which the customers want to create themselves, and they want to highlight areas, underline other text, make some bold, and change print sizes. All of this is possible using the RTF5 class.

I am able to retrieve text from a memo field in an .FPT file, Edit it with the RichEdit5 control, and save it back to the .FPT file. Here is an example of what is saved which is the text and all of the control codes:

Code: Select all  Expand view  RUN

{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 ARIAL;}}
{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}
{\*\generator Riched20 10.0.22000}\viewkind4\uc1
\pard\f0\fs20 I, the Registered Owner hereby authorize the above repair work to be done along with the necessary materials, and hereby grant you and/or your employees, permission  to operate the car, truck or vehicle herein described on streets, highways or elsewhere for the purpose of testing and/or inspection. I understand any cost quoted heretofore is an estimate only. All charges for labor are not based on actual mechanics time, but are established by multiplying our retail labor rate by industry time allowances or our own judgment of the time to be charged. \cf1 An express mechanic's lien is hereby acknowledged on the above car, truck or vehicle to secure the amount of repairs thereto\cf0 . In the event any attorney is retained to bring suit for collection of any sums due, I agree to pay costs of collection and reasonable attorney fees. I also understand that the dealer is not a depository for personal property left in the vehicle and assumes no risk for loss thereof. You will not be held responsible for loss or damage to vehicle, or articles left in vehicle in case of fire, theft, accident or any other cause beyond your control. If car is not picked up within (3) days after work is completed, a storage charge of $50.00 per day will be added to the total bill. I understand there is a $25.00 return check charge for all returned checks. I have read and understand the above.                                        \par
\par
OWNER______________________________________DATE______________  \par
\b The dealer named above is authorized by me to perform Smog Control Inspection as required by Article 5.5 of the California Motor Vehicle Inspection Program. The total of performing required inspection services has been explained to my satisfaction. I understand I am liable for costs up to the estimated amounts shown whether the vehicle qualifies for certification or not.     \b0   \par
                                                                                                                                                                                                                      \par
OWNER______________________________________DATE______________                                                                 \par
\cf2 SOME EMISSION CONTROL DEVICES MAY BE COVERED UNDER MANUFACTURES WARRANTY.  BY LAW, YOU MAY CHOSE ANOTHER LICENSED SMOG CHECK FACILITY TO PERFORM ANY NEEDED REPAIRS WHICH THE SMOG TEST INDICATES ARE NECESSARY.\par
}


On the invoice, I normally print the text using the following code:
Code: Select all  Expand view  RUN

   FOR lx := 1 TO MLCount( oEndText:tagtext, 120,, .T. )
      WOPAGEHEAD( oPrn, aHead )
       oPrn:SayText( nRow, 2 * nCsp, MemoLine( oEndText:tagtext, 120, lx,, .T. ),nCsp*120, nRsp * 1.1, oFcond )
      nRow += nRsp
   NEXT
 


This works perfectly for normal memo text, but when the saved text is RTF, it prints the text and formatting codes just as you see it in the first codebox above.

What I need is a way to print RichTextFormatted text in it's encoded form. Normally I would expect the tPrinter class to have an oPrn:SayRTF( ) capability but that does not exist.

Right now I provide the formatted text in pre-defined fonts, and colors, but that is by section, and that does not give the user the control they would like to do the formatting.

Has ANYONE had success printing an RTF text using the tPrinter class where the other text is all handled by the SayText() method????l

Anyone ???

Thank you for your input.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Print RTF using tPRINTER class ?????

Postby cnavarro » Fri Dec 10, 2021 6:34 pm

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Print RTF using tPRINTER class ?????

Postby TimStone » Fri Dec 10, 2021 11:15 pm

Looking at this code:

Code: Select all  Expand view  RUN

         oPrn:Box( aRTF[ 1 ] + 10, 90, aRtf[ 2 ] + 1000, aRTF[ 1 ] + 1010 )

         aRTF := REPrintBox5( oRTF:hWnd, If( lPreview, oPrn:hDCOut, oPrn:hDC ), ;
                              oRTF:IsSelection(), ;
                              aRTF[ 1 ] + 20, 110, aRTF[ 1 ] + 1000, aRtf[ 2 ] + 990, 0 )

 


The first line is to draw a box around the text to be printed ( optional ) and I understand that.

I'm focused on the actual print line. I've seen this example before. However, where is REPrintBox5( ). I can't find the source, or call, anywhere in FWH. Also, the positions are calculated in the .prg for each row, using nRsp and nCsp ( row, column ). I assume I can substitute in those values for the RTF values.

To properly work with this, I'd be best if I could see the REPrintBox5() function and code. Then I know the values to feed to it.
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Print RTF using tPRINTER class ?????

Postby Antonio Linares » Sat Dec 11, 2021 7:34 am

Dear Tim,

I am checking with Rao and Cristobal to implement a

oPrinter:SayRTF()

based on:
REPrintBox5( oRTF:hWnd, If( lPreview, oPrn:hDCOut, oPrn:hDC ), ;
oRTF:IsSelection(), ;
aRTF[ 1 ] + 20, 110, aRTF[ 1 ] + 1000, aRtf[ 2 ] + 990, 0 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Print RTF using tPRINTER class ?????

Postby TimStone » Sat Dec 11, 2021 2:51 pm

That would be awesome. I think it would be very useful


Sent from my iPhone using Tapatalk
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Print RTF using tPRINTER class ?????

Postby TimStone » Thu Jan 13, 2022 1:29 am

Antonio,

Was there ever any follow up on this question ? It would be very helpful.

Tim
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: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Print RTF using tPRINTER class ?????

Postby Antonio Linares » Thu Jan 13, 2022 8:52 am

Dear Tim,

Both Cristobal and Mr. Rao were going to implement it, but they couldn't do it yet
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests