how to print rich text format in VFP report layout ? 
Author Message
 how to print rich text format in VFP report layout ?

Has anybody succeeded on printing rich text format within a VFP frx ?

I have a table with a field type general and I am "APPENDing GENERAL
myfield  FROM myfile" where myfile is a RTF file.

I created a report layout and in the detail band I inserted an OLE
control whose field source is myfield.
When I run the report, instead of the text inside myfield all I'm
getting is an icon for the RTF file.

Any suggestion will be greatly appreciated.
Pablo De la Puente



Sun, 27 Oct 2002 03:00:00 GMT  
 how to print rich text format in VFP report layout ?
Maybe this could help you, i tested and it's really works.

HOWTO: Apply Rich Text Effects in Visual FoxPro Reports

----------------------------------------------------------------------------
----
The information in this article applies to:

Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0
on the following platforms: NT, Win95, Win98

----------------------------------------------------------------------------
----

SUMMARY
From time to time it would be good to have the ability to add formatting
effects to individual words within Microsoft Visual FoxPro reports. This can
be accomplished with the Rich Text ActiveX control, a general field and a
OLE bound control on a Visual FoxPro report.

MORE INFORMATION
This example shows how to underline parts of a field from a table and
display that formatting on a report. You can apply any effect or combination
of effects possible in Rich Text to your example.

Open Visual FoxPro and create a new report.

Add a Picture/Active-X Bound Control to the detail band of the report. Set
its FIELD property to Dcolor.gcolor.

Save the report as rtfDemo.

Paste the following code into a new program. Save that program in the same
directory as the report, then run it.

CLOSE ALL
CLEAR ALL
tSafety = SET("safety") &&Store SET status of Safety to a variable
SET SAFETY OFF &&Check to see if the Dcolor table exists
IF FILE("dcolor.dbf")
 USE dcolor EXCLUSIVE
ELSE
 CREATE TABLE dcolor (dcolor c(20),gcolor g) &&Create and add records if
DColor table doesn't exist
 INSERT INTO dcolor (dcolor) VALUES ("Red")
 INSERT INTO dcolor (dcolor) VALUES ("Green")
 INSERT INTO dcolor (dcolor) VALUES ("Blue")
 INSERT INTO dcolor (dcolor) VALUES ("Purple")
 INSERT INTO dcolor (dcolor) VALUES ("Orange")
 INSERT INTO dcolor (dcolor) VALUES ("Yellow")
ENDIF
_rtfFile = SYS(3)+".rtf" &&Create a legal file name with a .RTF extension
*NOTE: The file must have a .RTF extension to work properly
SCAN &&Create a Richtext OLE bound control in the general field of the
dColor table
 SET TEXTMERGE TO &_rtfFile NOSHOW
 SET TEXTMERGE ON
 *!!IMPORTANT!! The following richtext formatting line(s) need to be
         *included as one line in your program.
         \\{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl
         {\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\f0\fs20
          The big \ul <<ALLT(dcolor.dcolor)>>\ulnone  dog\par}
 SET TEXTMERGE TO
 APPEND GENERAL gcolor FROM &_rtfFile CLASS "RICHTEXT.RICHTEXTCTRL.1"
ENDSCAN
SET SAFETY &tSafety
ERASE &_rtfFile

REPORT FORM rtfdemo PREVIEW NOCONSOLE
USE
CLOSE ALL
When the report is printed, the color is underlined in the text.

NOTE: In some cases the print preview of RTF formatted text does not look
correct. However, when the string is printed, the output is formatted
correctly .

TIP: To generate a string similar to the one in the above code, create a
template for your expression in Microsoft WordPad (or other application
capable of creating Rich Text Files). Underline, color, and apply any other
formatting to your text, then save it to a .RTF file. Open the .RTF file in
Notepad and copy/paste the Rich Text code into your Visual FoxPro program.

(This application requires the RichTX32.OCX control. Visual FoxPro 3.0 and
3.0b do not ship with RichTX32.OCX.)

Additional query words:

Keywords : kbActiveX kbReportWriter kbVFp300 kbVFp300b kbVFp500 kbVFp500a
kbVFp600 kbGrpFox
Version : WINDOWS:3.0,3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbhowto

--
-------------------------------------------------------------
Mail to: Emil_39 NOSPAMPLEASE hotmail.com



Tue, 29 Oct 2002 03:00:00 GMT  
 how to print rich text format in VFP report layout ?
Emiliano,

Were you able to print the RTF fields ?
I can visualize them when I browse the table but when I print or preview the
report, all I'm getting are icon representations.

It says on the document that  RichTX32.OCX is required.
Could you  tell me, for that file, which version or date you have ?

TIA
Pablo



Tue, 05 Nov 2002 03:00:00 GMT  
 how to print rich text format in VFP report layout ?
I use the method as below to print the rich text format in VFP report, but
when i re-print the report in
second time immediately, the OLE Error come out.

*-- get temp file
m.cTmp = fctempfile() + ".RTF"

SELECT Event.* FROM Event ;
 ORDER BY Event.code ;
 INTO DBF lai

ALTER TABLE lai ADD COLUMN Rtf  G
GOTO TOP
DO WHILE !EOF()
 m.cText = Memo
 m.cTmp = fcWritetoFile( cText, m.cTmp )    && write memo content to temp.
file

 if !empty( m.cTmp )
  APPEND GENERAL Rtf FROM &cTmp CLASS "RICHTEXT.RICHTEXTCTRL.1"
 endif
 = fcEraseFile( m.cTmp )

 SKIP
ENDDO

*-- issue report command here

*-- error message show as below when i re-print the report in second time,
or third time immediately.
"APPEND GENERAL RTF from &cTmp CLASS "RICHTEXT.RICHTEXTCTRL.1 Error : 1426,
OLE error code
0x80004004 operation aboarted."

the next question is, the content of RTF got field line,when print the
report, it won't stretch the content ??

How to solve this ????



Mon, 23 Dec 2002 03:00:00 GMT  
 
 [ 4 post ] 

 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. 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