Printing rich text format 
Author Message
 Printing rich text format

I'm still having trouble printing the rich text format from VFP.  How do you do
it?  It appears that you need to run the SelPrint method.  The help file gives
this 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

But I still do not know how to access the commondialog.  Can someone help me
with this.  I have looked for the commondialog everywhere in the foundation
classes, component gallery and I can't find it.

Thanks.

Mike



Sat, 27 Jul 2002 03:00:00 GMT  
 Printing rich text format
Please let me know if you get a good response to your question....

--
William Fields
US Bankruptcy Court
Phoenix, AZ

Quote:
> I'm still having trouble printing the rich text format from VFP.  How do
you do
> it?  It appears that you need to run the SelPrint method.  The help file
gives
> this 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

> But I still do not know how to access the commondialog.  Can someone help
me
> with this.  I have looked for the commondialog everywhere in the
foundation
> classes, component gallery and I can't find it.

> Thanks.

> Mike



Sat, 27 Jul 2002 03:00:00 GMT  
 Printing rich text format
Mike,

Drop an OLE Container control on the form with the RTF control. Choose
Insert Control. Then select Microsoft Common Dialog Control. Right click the
control to get help.

David Dunetz
SweetWARE


Quote:
> I'm still having trouble printing the rich text format from VFP.  How do
you do
> it?  It appears that you need to run the SelPrint method.  The help file
gives
> this 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

> But I still do not know how to access the commondialog.  Can someone help
me
> with this.  I have looked for the commondialog everywhere in the
foundation
> classes, component gallery and I can't find it.

> Thanks.

> Mike



Sat, 27 Jul 2002 03:00:00 GMT  
 Printing rich text format
This is getting beyond frustrating.  Okay, I dropped the common dialog control
on the form.  The example from the help file still has me totally messed up:

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 is
   CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums

they are not defined

   RichTextBox1.SelPrint CommonDialog1.hDC
gives an error.

I feel like I'm getting closer to a solution but not yet.  Also, is it possible
to print in RTF without displaying the printer dialog.  Thanks again.

Quote:
>Subject: Re: Printing rich text format

>Date: 2/8/00 4:29 PM Pacific Standard Time

>Mike,

>Drop an OLE Container control on the form with the RTF control. Choose
>Insert Control. Then select Microsoft Common Dialog Control. Right click the
>control to get help.

>David Dunetz
>SweetWARE

Mike


Sun, 28 Jul 2002 03:00:00 GMT  
 Printing rich text format
Your example is Visual Basic, see Microsoft KB article Q170126.

Rasmus


Quote:
> This is getting beyond frustrating.  Okay, I dropped the common dialog
control
> on the form.  The example from the help file still has me totally messed
up:

> 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 is
>    CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums

> they are not defined

>    RichTextBox1.SelPrint CommonDialog1.hDC
> gives an error.

> I feel like I'm getting closer to a solution but not yet.  Also, is it
possible
> to print in RTF without displaying the printer dialog.  Thanks again.

> >Subject: Re: Printing rich text format

> >Date: 2/8/00 4:29 PM Pacific Standard Time

> >Mike,

> >Drop an OLE Container control on the form with the RTF control. Choose
> >Insert Control. Then select Microsoft Common Dialog Control. Right click
the
> >control to get help.

> >David Dunetz
> >SweetWARE

> Mike



Sun, 28 Jul 2002 03:00:00 GMT  
 Printing rich text format
The constants are defined in the help file. If you can't get it by right
clicking the control and choosing help, look for the COMCTL1.HLP file in the
\WINDOWS\HELP folder.
Search for CommonDialog Constants.

David Dunetz
SweetWARE


Quote:
> This is getting beyond frustrating.  Okay, I dropped the common dialog
control
> on the form.  The example from the help file still has me totally messed
up:

> 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 is
>    CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums

> they are not defined

>    RichTextBox1.SelPrint CommonDialog1.hDC
> gives an error.

> I feel like I'm getting closer to a solution but not yet.  Also, is it
possible
> to print in RTF without displaying the printer dialog.  Thanks again.

> >Subject: Re: Printing rich text format

> >Date: 2/8/00 4:29 PM Pacific Standard Time

> >Mike,

> >Drop an OLE Container control on the form with the RTF control. Choose
> >Insert Control. Then select Microsoft Common Dialog Control. Right click
the
> >control to get help.

> >David Dunetz
> >SweetWARE

> Mike



Sun, 28 Jul 2002 03:00:00 GMT  
 Printing rich text format
If you're inquiring on how to open a specific Common Dialog dialog.
Add OLE Common Dialog control then:

#DEFINE CDIALOG_OPEN 1
#DEFINE CDIALOG_SAVEAS 2
#DEFINE CDIALOG_COLOR 3
#DEFINE CDIALOG_FONT 4
#DEFINE CDIALOG_PRINT 5

thisform.oleCDialog.action= <constant>

There may be system defined constants but if so I am not familiar with
them.

Dave



Quote:
> I'm still having trouble printing the rich text format from VFP.  How
do you do
> it?  It appears that you need to run the SelPrint method.  The help
file gives
> this 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

> But I still do not know how to access the commondialog.  Can someone
help me
> with this.  I have looked for the commondialog everywhere in the
foundation
> classes, component gallery and I can't find it.

> Thanks.

> Mike

Sent via Deja.com http://www.deja.com/
Before you buy.


Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
HELP HELP HELP HELP HELP HELP HELP HELP

Is there no end to this problem?  First, it seems like no one has ever printed
rich text format in VFP because no one seems to be able to solve this problem.
Your idea of checking the Microsoft Article Q170126 was the most helpful of all
and of course that did NOT WORK EITHER.

The article is a little confusing.  In the article it says there was a bug in
VFP 5 and was fixed in VFP 6. However, it goes on to say that it would work in
NT when the VB code is changed to VFP.  But it says it only works in NT and not
in Win 95.  Does this mean that it was fixed in VFP 6 to work on both platforms
or is there still a bug in Win 95? If it was fixed completely in VFP 6, SP3
then I'm at a loss because it still does not appear to work.

Here's What Happens Now
----------------------------------------
I am so frustrated!  I tried entering the code and now what happens is the
printer dialog comes up and nothing prints.  To add to the problem, there is no
way to get rid of the printer dialog.  It's like VFP is locked at the printer
dialog and I can't get out.  I tried clicking print, Cancel, nothing works.  I
have to Ctrl-Alt-Delete and end task in VFP.  Is there any answer to printing
RTF?  They say it's a bug in VFP 5 but was fixed in VFP 6;  sure.....  Here's
the code in the Microsoft article.

Part of the code has the following line in it:
Thisform.CommDlg1.hDC

I could not even find an hDC property for the common dialog.  What's going on?
Here's the rest of the code:

cdlPDReturnDC=256
cdlPDNoPageNums=8
cdlPDSelection=1
cdlPDAllPages=0

Thisform.CommDlg1.Flags = cdlPDReturnDC + cdlPDNoPageNums
If Thisform.RTF1.SelLength = 0
Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
+ cdlPDAllPages
Else
Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
+ cdlPDSelection
EndIf
Thisform.CommDlg1.ShowPrinter
Thisform.RTF1.SelPrint(Thisform.CommDlg1.hDC)

Thanks for the help

Quote:
>Subject: Re: Printing rich text format

>Date: 2/8/00 11:18 PM Pacific Standard Time

>Your example is Visual Basic, see Microsoft KB article Q170126.

>Rasmus

Mike


Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
As I mentioned in a different post, I've done this before
but I'm not sure the effort is worthwhile - your call.

I'm not sure about your object naming conventions, so I'll start
from scratch.

Add a CommonDialog control (version 6)  to your form using an OLE Container.
Name this OleComDlg

Add an RTF control in the same fashion. Name it OleRtf.

Add a command button. Name it CmdPrint.

In the Click event of CmdPrint, put the following:

#DEFINE cdlPDReturnDC 0x100
#DEFINE cdlPDNoPageNums 0x8
#DEFINE cdlPDSelection 0x1
#DEFINE cdlPDAllPages 0x0

ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
If ThisForm.OleRTF.Object.SelLength = 0
 ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
  + cdlPDAllPages
Else
 ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
 + cdlPDSelection
EndIf
ThisForm.OleComDlg.Object.ShowPrinter
ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

Works OK for me.

Roger


Quote:
> HELP HELP HELP HELP HELP HELP HELP HELP

> Is there no end to this problem?  First, it seems like no one has ever printed
> rich text format in VFP because no one seems to be able to solve this problem.
> Your idea of checking the Microsoft Article Q170126 was the most helpful of
all
> and of course that did NOT WORK EITHER.

> The article is a little confusing.  In the article it says there was a bug in
> VFP 5 and was fixed in VFP 6. However, it goes on to say that it would work in
> NT when the VB code is changed to VFP.  But it says it only works in NT and
not
> in Win 95.  Does this mean that it was fixed in VFP 6 to work on both
platforms
> or is there still a bug in Win 95? If it was fixed completely in VFP 6, SP3
> then I'm at a loss because it still does not appear to work.

> Here's What Happens Now
> ----------------------------------------
> I am so frustrated!  I tried entering the code and now what happens is the
> printer dialog comes up and nothing prints.  To add to the problem, there is
no
> way to get rid of the printer dialog.  It's like VFP is locked at the printer
> dialog and I can't get out.  I tried clicking print, Cancel, nothing works.  I
> have to Ctrl-Alt-Delete and end task in VFP.  Is there any answer to printing
> RTF?  They say it's a bug in VFP 5 but was fixed in VFP 6;  sure.....  Here's
> the code in the Microsoft article.

> Part of the code has the following line in it:
> Thisform.CommDlg1.hDC

> I could not even find an hDC property for the common dialog.  What's going on?
> Here's the rest of the code:

> cdlPDReturnDC=256
> cdlPDNoPageNums=8
> cdlPDSelection=1
> cdlPDAllPages=0

> Thisform.CommDlg1.Flags = cdlPDReturnDC + cdlPDNoPageNums
> If Thisform.RTF1.SelLength = 0
> Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
> + cdlPDAllPages
> Else
> Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
> + cdlPDSelection
> EndIf
> Thisform.CommDlg1.ShowPrinter
> Thisform.RTF1.SelPrint(Thisform.CommDlg1.hDC)

> Thanks for the help

> >Subject: Re: Printing rich text format

> >Date: 2/8/00 11:18 PM Pacific Standard Time

> >Your example is Visual Basic, see Microsoft KB article Q170126.

> >Rasmus

> Mike



Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
Roger,

I'm a little confused about something in your reply.  What is the .object for?
In other words, you have things like this in your code:

If ThisForm.OleRTF.Object.SelLength = 0

Wouldn't it just be
if thisform.OleRtf.SelLength = 0

I don't understand what the .object is all about after the OleRtf and the
common dialog.  Wouldn't that give an error?

Thanks.

Quote:
>Subject: Re: Printing rich text format

>Date: 2/10/00 5:02 AM Pacific Standard Time

>As I mentioned in a different post, I've done this before
>but I'm not sure the effort is worthwhile - your call.

>I'm not sure about your object naming conventions, so I'll start
>from scratch.

>Add a CommonDialog control (version 6)  to your form using an OLE Container.
>Name this OleComDlg

>Add an RTF control in the same fashion. Name it OleRtf.

>Add a command button. Name it CmdPrint.

>In the Click event of CmdPrint, put the following:

>#DEFINE cdlPDReturnDC 0x100
>#DEFINE cdlPDNoPageNums 0x8
>#DEFINE cdlPDSelection 0x1
>#DEFINE cdlPDAllPages 0x0

>ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
>If ThisForm.OleRTF.Object.SelLength = 0
> ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
>  + cdlPDAllPages
>Else
> ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> + cdlPDSelection
>EndIf
>ThisForm.OleComDlg.Object.ShowPrinter
>ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

>Works OK for me.

Mike


Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
Mike,

When you put an ActiveX control on a form, it is placed in an OLE Container
control. Then the container hierarchy is the form, the OLE container and the
ActiveX control. In your example, the OleRTF refers to the container, and
the Object keyword refers to the RTF control itself.

In many cases you can refer to properties of the ActiveX control by
referencing the OLE container, but you will find that sometimes the Object
keyword is necessary to get things to work correctly.

David Dunetz
SweetWARE


Quote:
> Roger,

> I'm a little confused about something in your reply.  What is the .object
for?
> In other words, you have things like this in your code:

> If ThisForm.OleRTF.Object.SelLength = 0

> Wouldn't it just be
> if thisform.OleRtf.SelLength = 0

> I don't understand what the .object is all about after the OleRtf and the
> common dialog.  Wouldn't that give an error?

> Thanks.

> >Subject: Re: Printing rich text format

> >Date: 2/10/00 5:02 AM Pacific Standard Time

> >As I mentioned in a different post, I've done this before
> >but I'm not sure the effort is worthwhile - your call.

> >I'm not sure about your object naming conventions, so I'll start
> >from scratch.

> >Add a CommonDialog control (version 6)  to your form using an OLE
Container.
> >Name this OleComDlg

> >Add an RTF control in the same fashion. Name it OleRtf.

> >Add a command button. Name it CmdPrint.

> >In the Click event of CmdPrint, put the following:

> >#DEFINE cdlPDReturnDC 0x100
> >#DEFINE cdlPDNoPageNums 0x8
> >#DEFINE cdlPDSelection 0x1
> >#DEFINE cdlPDAllPages 0x0

> >ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
> >If ThisForm.OleRTF.Object.SelLength = 0
> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> >  + cdlPDAllPages
> >Else
> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> > + cdlPDSelection
> >EndIf
> >ThisForm.OleComDlg.Object.ShowPrinter
> >ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

> >Works OK for me.

> Mike



Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
So do I actually type the word "object" and if not how do I find out what to
type instead.  Right now the code would just read:

if ThisForm.OleRTF.SelLength = 0

instead of

if ThisForm.OleRTF.Object.SelLength = 0

(you want me to actually type the word "object" is this correct?)

Also, do you know if it works for you on a Win 95/98 system or are you on NT?

Thanks.

Quote:
>Subject: Re: Printing rich text format

>Date: 2/10/00 12:12 PM Pacific Standard Time

>Mike,

>When you put an ActiveX control on a form, it is placed in an OLE Container
>control. Then the container hierarchy is the form, the OLE container and the
>ActiveX control. In your example, the OleRTF refers to the container, and
>the Object keyword refers to the RTF control itself.

>In many cases you can refer to properties of the ActiveX control by
>referencing the OLE container, but you will find that sometimes the Object
>keyword is necessary to get things to work correctly.

>David Dunetz
>SweetWARE



>> Roger,

>> I'm a little confused about something in your reply.  What is the .object
>for?
>> In other words, you have things like this in your code:

>> If ThisForm.OleRTF.Object.SelLength = 0

>> Wouldn't it just be
>> if thisform.OleRtf.SelLength = 0

>> I don't understand what the .object is all about after the OleRtf and the
>> common dialog.  Wouldn't that give an error?

>> Thanks.

>> >Subject: Re: Printing rich text format

>> >Date: 2/10/00 5:02 AM Pacific Standard Time

>> >As I mentioned in a different post, I've done this before
>> >but I'm not sure the effort is worthwhile - your call.

>> >I'm not sure about your object naming conventions, so I'll start
>> >from scratch.

>> >Add a CommonDialog control (version 6)  to your form using an OLE
>Container.
>> >Name this OleComDlg

>> >Add an RTF control in the same fashion. Name it OleRtf.

>> >Add a command button. Name it CmdPrint.

>> >In the Click event of CmdPrint, put the following:

>> >#DEFINE cdlPDReturnDC 0x100
>> >#DEFINE cdlPDNoPageNums 0x8
>> >#DEFINE cdlPDSelection 0x1
>> >#DEFINE cdlPDAllPages 0x0

>> >ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
>> >If ThisForm.OleRTF.Object.SelLength = 0
>> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
>> >  + cdlPDAllPages
>> >Else
>> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
>> > + cdlPDSelection
>> >EndIf
>> >ThisForm.OleComDlg.Object.ShowPrinter
>> >ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

>> >Works OK for me.

>> Mike

Mike


Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
Mike,

if ThisForm.OleRTF.Object.SelLength = 0

is the correct syntax. It will sometimes work the other way, but it should
ALWAYS work if you include the Object keyword. (I hesitate to say ALWAYS,
especially where FoxPro is concerned, but I said it anyway.)

The syntax is the same for any version of Windows.

David Dunetz
SweetWARE


Quote:
> So do I actually type the word "object" and if not how do I find out what
to
> type instead.  Right now the code would just read:

> if ThisForm.OleRTF.SelLength = 0

> instead of

> if ThisForm.OleRTF.Object.SelLength = 0

> (you want me to actually type the word "object" is this correct?)

> Also, do you know if it works for you on a Win 95/98 system or are you on
NT?

> Thanks.

> >Subject: Re: Printing rich text format

> >Date: 2/10/00 12:12 PM Pacific Standard Time

> >Mike,

> >When you put an ActiveX control on a form, it is placed in an OLE
Container
> >control. Then the container hierarchy is the form, the OLE container and
the
> >ActiveX control. In your example, the OleRTF refers to the container, and
> >the Object keyword refers to the RTF control itself.

> >In many cases you can refer to properties of the ActiveX control by
> >referencing the OLE container, but you will find that sometimes the
Object
> >keyword is necessary to get things to work correctly.

> >David Dunetz
> >SweetWARE



> >> Roger,

> >> I'm a little confused about something in your reply.  What is the
.object
> >for?
> >> In other words, you have things like this in your code:

> >> If ThisForm.OleRTF.Object.SelLength = 0

> >> Wouldn't it just be
> >> if thisform.OleRtf.SelLength = 0

> >> I don't understand what the .object is all about after the OleRtf and
the
> >> common dialog.  Wouldn't that give an error?

> >> Thanks.

> >> >Subject: Re: Printing rich text format

> >> >Date: 2/10/00 5:02 AM Pacific Standard Time

> >> >As I mentioned in a different post, I've done this before
> >> >but I'm not sure the effort is worthwhile - your call.

> >> >I'm not sure about your object naming conventions, so I'll start
> >> >from scratch.

> >> >Add a CommonDialog control (version 6)  to your form using an OLE
> >Container.
> >> >Name this OleComDlg

> >> >Add an RTF control in the same fashion. Name it OleRtf.

> >> >Add a command button. Name it CmdPrint.

> >> >In the Click event of CmdPrint, put the following:

> >> >#DEFINE cdlPDReturnDC 0x100
> >> >#DEFINE cdlPDNoPageNums 0x8
> >> >#DEFINE cdlPDSelection 0x1
> >> >#DEFINE cdlPDAllPages 0x0

> >> >ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
> >> >If ThisForm.OleRTF.Object.SelLength = 0
> >> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> >> >  + cdlPDAllPages
> >> >Else
> >> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> >> > + cdlPDSelection
> >> >EndIf
> >> >ThisForm.OleComDlg.Object.ShowPrinter
> >> >ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

> >> >Works OK for me.

> >> Mike

> Mike



Mon, 29 Jul 2002 03:00:00 GMT  
 Printing rich text format
Quote:
>What is the .object for?

Look in the de{*filter*}'s watch window and examine the
form's hierarchy. Also I recommend you read chapter 16
in the programmer's guide - especially "Adding ActiveX
controls to a Form"

Quote:
>Wouldn't that give an error?

Why not run the code and see?.

Roger


Quote:
> Roger,

> I'm a little confused about something in your reply.  What is the .object for?
> In other words, you have things like this in your code:

> If ThisForm.OleRTF.Object.SelLength = 0

> Wouldn't it just be
> if thisform.OleRtf.SelLength = 0

> I don't understand what the .object is all about after the OleRtf and the
> common dialog.  Wouldn't that give an error?

> Thanks.

> >Subject: Re: Printing rich text format

> >Date: 2/10/00 5:02 AM Pacific Standard Time

> >As I mentioned in a different post, I've done this before
> >but I'm not sure the effort is worthwhile - your call.

> >I'm not sure about your object naming conventions, so I'll start
> >from scratch.

> >Add a CommonDialog control (version 6)  to your form using an OLE Container.
> >Name this OleComDlg

> >Add an RTF control in the same fashion. Name it OleRtf.

> >Add a command button. Name it CmdPrint.

> >In the Click event of CmdPrint, put the following:

> >#DEFINE cdlPDReturnDC 0x100
> >#DEFINE cdlPDNoPageNums 0x8
> >#DEFINE cdlPDSelection 0x1
> >#DEFINE cdlPDAllPages 0x0

> >ThisForm.OleComDlg.Object.Flags = cdlPDReturnDC
> >If ThisForm.OleRTF.Object.SelLength = 0
> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> >  + cdlPDAllPages
> >Else
> > ThisForm.OleComDlg.Object.Flags = ThisForm.OleComDlg.Object.Flags ;
> > + cdlPDSelection
> >EndIf
> >ThisForm.OleComDlg.Object.ShowPrinter
> >ThisForm.OleRTF.Object.SelPrint(ThisForm.OleComDlg.Object.hDC)

> >Works OK for me.

> Mike



Tue, 30 Jul 2002 03:00:00 GMT  
 Printing rich text format
Remember to put a sys(2333,0) in the load event of your form or the printing
will not work.

Rasmus


Quote:
> HELP HELP HELP HELP HELP HELP HELP HELP

> Is there no end to this problem?  First, it seems like no one has ever
printed
> rich text format in VFP because no one seems to be able to solve this
problem.
> Your idea of checking the Microsoft Article Q170126 was the most helpful
of all
> and of course that did NOT WORK EITHER.

> The article is a little confusing.  In the article it says there was a bug
in
> VFP 5 and was fixed in VFP 6. However, it goes on to say that it would
work in
> NT when the VB code is changed to VFP.  But it says it only works in NT
and not
> in Win 95.  Does this mean that it was fixed in VFP 6 to work on both
platforms
> or is there still a bug in Win 95? If it was fixed completely in VFP 6,
SP3
> then I'm at a loss because it still does not appear to work.

> Here's What Happens Now
> ----------------------------------------
> I am so frustrated!  I tried entering the code and now what happens is the
> printer dialog comes up and nothing prints.  To add to the problem, there
is no
> way to get rid of the printer dialog.  It's like VFP is locked at the
printer
> dialog and I can't get out.  I tried clicking print, Cancel, nothing
works.  I
> have to Ctrl-Alt-Delete and end task in VFP.  Is there any answer to
printing
> RTF?  They say it's a bug in VFP 5 but was fixed in VFP 6;  sure.....
Here's
> the code in the Microsoft article.

> Part of the code has the following line in it:
> Thisform.CommDlg1.hDC

> I could not even find an hDC property for the common dialog.  What's going
on?
> Here's the rest of the code:

> cdlPDReturnDC=256
> cdlPDNoPageNums=8
> cdlPDSelection=1
> cdlPDAllPages=0

> Thisform.CommDlg1.Flags = cdlPDReturnDC + cdlPDNoPageNums
> If Thisform.RTF1.SelLength = 0
> Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
> + cdlPDAllPages
> Else
> Thisform.CommDlg1.Flags = Thisform.CommDlg1.Flags ;
> + cdlPDSelection
> EndIf
> Thisform.CommDlg1.ShowPrinter
> Thisform.RTF1.SelPrint(Thisform.CommDlg1.hDC)

> Thanks for the help

> >Subject: Re: Printing rich text format

> >Date: 2/8/00 11:18 PM Pacific Standard Time

> >Your example is Visual Basic, see Microsoft KB article Q170126.

> >Rasmus

> Mike



Tue, 30 Jul 2002 03:00:00 GMT  
 
 [ 24 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Printing Rich Text Format in VFP

2. Rich Text Format Printing Problem

3. Rich Text Format Print Problem

4. Rich Text Format Printing

5. How can I print a Rich Text Format?

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

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

8. Rich Text Format / WP style in Fox?

9. Rich Text Format etc.

10. Rich Text format

11. Rich text format

12. Need Help With (RTF) rich text format

 

 
Powered by phpBB® Forum Software