Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: prasanna kunder
  Where is prasanna kunder?
 mumbai
 India
 prasanna kunder
 Tags
Subject: RE: how insert ole oject into report
Thread ID: 311219 Message ID: 311233 # Views: 70 # Ratings: 2
Version: Visual FoxPro 7 Category: Classes and Objects
Date: Wednesday, June 29, 2011 9:13:35 PM         
   


> hello experts
>
> i made one form with RichText Control Properties
> data updated to memo field in the table
> everything working properly
>
> now pl.tell me how will i insert control into the report
>
> my memo field data show like this
>
> {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial Black;}}
> \viewkind4\uc1\pard\lang1033\fs18 The Rates are inclusive of Vat,Octrai and Transport Consignee : \b GSD \ul\i\fs30 Con\f1 struction\ulnone\b0\i0\f0\fs18
> \par RHS Building No 1 & 2 Contact Person on Site : Mr. Mohan Bhoir
> \par \i Akruti Green \i0 Woods
> \par Vartak \i\fs24 Naga\i0\fs18 r Contact No On Site.: 9594047550
> \par Thane
> \par Destination : Vartak Nagar Thane
> \par
> \par Payment Terms.:
> \par }
>
> thanks
> prasanna


I give you a prototype to work.
you must use a general field and fill it with rtf data
create a report with an oleboundcontrol linked to the general field
fill the g fields with rtf using "append general field from...class.."
and then you can print easily
recommendation :dont up to one page per record.
this is the code, you can find all the project in the zip below.
close data all

text to myvar1 noshow  &&your rtf text here
{\rtf1\<font color="Blue">ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Arial Black;}}
\viewkind4\uc1\pard\lang1033\fs18 The Rates are inclusive of Vat,Octrai and Transport Consignee : \b GSD \ul\i\fs30 Con\f1 struction\ulnone\b0\i0\f0\fs18
\par RHS Building No 1 & 2 Contact Person on Site : Mr. Mohan Bhoir
\par \i Akruti Green \i0 Woods
\par Vartak \i\fs24 Naga\i0\fs18 r Contact No On Site.: 9594047550
\par Thane
\par Destination : Vartak Nagar Thane
\par
\par Payment Terms.:
\par }
endtext
text to myvar2 noshow  &&another rtf here
{\rtf1\fbidis\<font color="Blue">ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Comic Sans MS;}{\f1\fswiss\fcharset0 Arial Black;}{\f2\fswiss\fcharset0 Arial;}}
{\colortbl ;\red0\green0\blue0;\red255\green255\blue0;\red255\green0\blue0;\red128\green255\blue255;}
\viewkind4\uc1\pard\ltrpar\li180\ri240\f0\fs26\u8204?\u8204?The RichTextBox provides a number of \cf1 properties you can \strike use\strike0  to apply formatting to any portion \highlight2 of text \cf3\b\i\fs32 within\cf1\b0\i0\fs26  the control\highlight0 . To change the formatting of text, it must first be selected. \f1\fs32 Only selected \highlight4 text can\highlight0  be assigned\f0\fs26  character and paragraph formatting. \highlight4 Using \b these properties\highlight0 , you\b0  can make text bold or italic, change the color, and create superscripts and subscripts. You can also adjust paragraph formatting by setting both left and right indents, as well as hanging indents.\f2\fs20 
\par \fs24 
\par \fs20 The \b RichTextBox\b0  also opens and saves files in both the RTF format and regular ASCII text format. You can use methods of the control (\b LoadFile\b0  and \b SaveFile\b0 ) to directly read and write files, or use properties of the control such as \b SelRTF\b0  and \b TextRTF\b0  in conjunction with Visual Basic's file input/output statements. You can also load the contents of an .RTF file into the \b RichTextBox\b0  control simply by dragging the file (from the Windows 95 Explorer for example), or a highlighted portion of a file used in another application (such as Microsoft Word), and dropping the contents directly onto the control. You can also set the \b FileName\b0  property to load the contents of an .RTF or text file to the control.\fs24 
\par }
endtext
set safe off
local afile1,afile2
afile1= sys(2023)+"\myrtf1.rtf"
afile2= sys(2023)+"\myrtf2.rtf"
strtofile(m.myvar1,m.afile1)
strtofile(m.myvar2,m.afile2)
set safe on


CREATE cursor  ycurs (num i,myrtf g)
for i=1 to 5  &&suppose 5 records to fill with rtf
INSERT INTO ycurs (num)  VALUES (i)
endfor


sele ycurs
scan
do case
case  inlist(recno(),1,3,5)
APPEND GENERAL myrtf FROM (afile1)  CLASS "RICHTEXT.RICHTEXTCTRL.1"
otherwise
APPEND GENERAL myrtf FROM (afile2)  CLASS "RICHTEXT.RICHTEXTCTRL.1"
endcase
endscan
*brow

REPORT FORM myRTFreport PREVIEW NOCONSOLE   &&report must be created with oleboundcontrol.
use in ycurs

https://www.foxite.com/uploads/ddc10e83-3188-4eac-bd0f-fdb873710174.zip

NB: the g field is not used actually anywhere .its an old coding.
-you can use a form with rtfbox to load any rtf and print directly to the printer teh contents with some APIs.
-can use word automation


Regards
Yousfi Benameu

ENTIRE THREAD

how insert ole oject into report Posted by prasanna kunder @ 6/29/2011 7:24:27 PM
RE: how insert ole oject into report Posted by Yousfi Benameur @ 6/29/2011 9:13:35 PM
RE: how insert ole oject into report Posted by prasanna kunder @ 6/30/2011 7:27:02 AM
RE: how insert ole oject into report Posted by Yousfi Benameur @ 6/30/2011 5:29:21 PM
RE: how insert ole oject into report Posted by Jun Tangunan @ 7/1/2011 3:24:41 AM
RE: how insert ole oject into report Posted by Mike Gagnon @ 6/30/2011 11:29:19 AM