Page 1 of 1

DCPRINT RTF question

Posted: Wed Aug 10, 2022 2:55 am
by skiman
Hi,

Customers are asking to have more possibilities when they enter data into a memofield. They would like to use at least bold or Italic in descriptions of products. This isn't a problem with DCRTF which can be adapted to their needs.

I thought I could use the dcprint RTF to print this on documents. If the description must be printed on invoices, i need to use the dcprint RTF. In my test it looks as this isn't working as expected.

Some questions:
- Can DCPRINT RTF be used to print in combination with other DCPRINT commands on the same page? I tried this with the invoice.prg in the samples\printer folder, and it doesn't work for me.
Added the below code at line 500 in invoice.prg.

Code: Select all

// Print RTF
cRtf := memoread("test.rtf")
@ 1,1,50,10 dcprint RTF cRtf
- Anyone who has another method to accomplisch this? When entering text use of BOLD and ITALIC, and the possibility to print this as part of a document?

Re: DCPRINT RTF question

Posted: Wed Aug 10, 2022 5:41 am
by rdonnay
This may be difficult, but I will look into it.

DCPRINT RTF uses the PrintRect() method of the XbpRtf() class and this may interfere with things.

Re: DCPRINT RTF question

Posted: Wed Aug 10, 2022 6:52 am
by skiman
Hi Roger,

I'm working on a solution for this. Since the RTF is a text file I can read, I can solve it by interpreting the codes in it.

Don't loose your time with it. Maybe someone had already a solution out of the box. That's why I asked the question.

Re: DCPRINT RTF question

Posted: Thu Aug 11, 2022 2:18 am
by skiman
Hi,

Meanwhile I succeeded to implement this. In attachment a PDF sample where a 'normal' memo field is printed, and a memo field with RTF content.

For my application I only need to have the Bold, Italic and Underline as extra options for product descriptions. It would also be possible to implement different fonts.

In short:
- Read the RTF as TXT and replace the codes you need, in my case \b , \b0 , \i , \i0 , \ul , \ulnone .
- Load it in an xbprtf.
- Get the oRtf:text
- Process it.

Since I can't upload PDF files, the PDF is included in the ZIP.

Re: DCPRINT RTF question

Posted: Thu Aug 11, 2022 5:58 am
by rdonnay
Very nice work!!!