Printing Rich Text Format in VFP 
Author Message
 Printing Rich Text Format in VFP

How can I print the RTF format in VFP?  It appears that the report writer can't
do it.  Is this true?

The help file displays the following (but I have questions on this that follow)

***********************************************************
SelPrint Method Example
This example prints the formatted text in a RichTextBox control. To try this
example, put a RichTextBox control, a CommonDialog control, and a CommandButton
control on a form. Paste this code into the Click event of the CommandButton
control. Then run the example.

Private Sub Command1_Click()
   CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
   If RichTextBox1.SelLength = 0 Then
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
   Else
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
   End If
   CommonDialog1.ShowPrinter
   Printer.Print ""
   RichTextBox1.SelPrint CommonDialog1.hDC
End Sub
***********************************************************

What in the world is a CommonDialog1 object?  How do I create that?  I'd like
to allow the user the flexibility to either preview or print the report.  I'd
also like the option to either bring up the printer dialog (if they click
File/Print, or just print the rich text without showing the dialog if they
click the printer on the toolbar).

Please help, thanks.

Mike



Tue, 16 Jul 2002 03:00:00 GMT  
 Printing Rich Text Format in VFP
Mike

Correct, the FoxPro report writer can't print RTF text.

Therefore, the rest may be of academic interest only.

The CommonDialog control is an ActiveX control which
ships with VFP6. You add it to a form in the same way
as you added the RTF control (select Microsoft Common
Dialog Control V 6.0).

The only purpose of using the CommonDialog control
with the RTF control is to obtain a device context (hDC).

You can then print the contents of an RTF control using the
code in the help file, converted to FoxSpeak.

Useful? Of course not.
IMHO the RTF control is little more than a distraction.
I played around with this endlessly some time ago and
apart from creating, storing and displaying RTF text,
it's a waste of time.

Unless, that is, someone else knows better.

Roger


Quote:
> How can I print the RTF format in VFP?  It appears that the report writer
can't
> do it.  Is this true?

> The help file displays the following (but I have questions on this that
follow)

> ***********************************************************
> SelPrint Method Example
> This example prints the formatted text in a RichTextBox control. To try this
> example, put a RichTextBox control, a CommonDialog control, and a
CommandButton
> control on a form. Paste this code into the Click event of the CommandButton
> control. Then run the example.

> Private Sub Command1_Click()
>    CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
>    If RichTextBox1.SelLength = 0 Then
>       CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
>    Else
>       CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
>    End If
>    CommonDialog1.ShowPrinter
>    Printer.Print ""
>    RichTextBox1.SelPrint CommonDialog1.hDC
> End Sub
> ***********************************************************

> What in the world is a CommonDialog1 object?  How do I create that?  I'd like
> to allow the user the flexibility to either preview or print the report.  I'd
> also like the option to either bring up the printer dialog (if they click
> File/Print, or just print the rich text without showing the dialog if they
> click the printer on the toolbar).

> Please help, thanks.

> Mike



Wed, 17 Jul 2002 03:00:00 GMT  
 Printing Rich Text Format in VFP
Thanks for the information about the CommonDialog.  I'll definitely check it
out.  I'm also pretty sure it's possible to convert the RTF to straight text
format which I could then store in a character string and print it that way
through the report writer.

However, on another note, I could not disagree with you more about RTF being a
waste of time in VFP.  When it comes to memo fields, fonts, bold, and color add
information.  It allows a user to highlight important notes in memo fields that
stand out.  Perhaps my needs may be different than yours but I believe RTF is
great to have in a database application.  Sure, it's probably a waste of time
to change fonts for basic field information like names, addresses, etc.  But,
once again, for memo fields it's great.

Quote:
>Subject: Re: Printing Rich Text Format in VFP

>Date: 1/28/00 6:01 AM Pacific Standard Time

>Mike

>Correct, the FoxPro report writer can't print RTF text.

>Therefore, the rest may be of academic interest only.

>The CommonDialog control is an ActiveX control which
>ships with VFP6. You add it to a form in the same way
>as you added the RTF control (select Microsoft Common
>Dialog Control V 6.0).

>The only purpose of using the CommonDialog control
>with the RTF control is to obtain a device context (hDC).

>You can then print the contents of an RTF control using the
>code in the help file, converted to FoxSpeak.

>Useful? Of course not.
>IMHO the RTF control is little more than a distraction.
>I played around with this endlessly some time ago and
>apart from creating, storing and displaying RTF text,
>it's a waste of time.

>Unless, that is, someone else knows better.

>Roger

Mike


Wed, 17 Jul 2002 03:00:00 GMT  
 Printing Rich Text Format in VFP

Quote:
> However, on another note, I could not disagree with you more about RTF being a
> waste of time in VFP.......

Good point.

Roger


Quote:
> Thanks for the information about the CommonDialog.  I'll definitely check it
> out.  I'm also pretty sure it's possible to convert the RTF to straight text
> format which I could then store in a character string and print it that way
> through the report writer.

> However, on another note, I could not disagree with you more about RTF being a
> waste of time in VFP.  When it comes to memo fields, fonts, bold, and color
add
> information.  It allows a user to highlight important notes in memo fields
that
> stand out.  Perhaps my needs may be different than yours but I believe RTF is
> great to have in a database application.  Sure, it's probably a waste of time
> to change fonts for basic field information like names, addresses, etc.  But,
> once again, for memo fields it's great.

> >Subject: Re: Printing Rich Text Format in VFP

> >Date: 1/28/00 6:01 AM Pacific Standard Time

> >Mike

> >Correct, the FoxPro report writer can't print RTF text.

> >Therefore, the rest may be of academic interest only.

> >The CommonDialog control is an ActiveX control which
> >ships with VFP6. You add it to a form in the same way
> >as you added the RTF control (select Microsoft Common
> >Dialog Control V 6.0).

> >The only purpose of using the CommonDialog control
> >with the RTF control is to obtain a device context (hDC).

> >You can then print the contents of an RTF control using the
> >code in the help file, converted to FoxSpeak.

> >Useful? Of course not.
> >IMHO the RTF control is little more than a distraction.
> >I played around with this endlessly some time ago and
> >apart from creating, storing and displaying RTF text,
> >it's a waste of time.

> >Unless, that is, someone else knows better.

> >Roger

> Mike



Wed, 17 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. how to print rich text format in VFP report layout ?

2. Rich Text Format Printing Problem

3. Rich Text Format Print Problem

4. Rich Text Format Printing

5. Printing rich text format

6. How can I print a Rich Text Format?

7. Rich Text Nightmare (merging two rich text files)

8. Windows API - Printing Rich Text in VFP

9. VFP 5.0 - How to print rich-text

10. Rich Text Format / WP style in Fox?

11. Rich Text Format etc.

12. Rich Text format

 

 
Powered by phpBB® Forum Software