1

Konu: RTF'yi rapor (frx) dosyasından yazdırmak mümkün mü?

Bir memo field'e RTF kodunu kaydedip bunu rapor dosyasından (frx) yazdırmak mümkün mü?
RTF OLE'yi ekleyecek yer göremedim report designer'da.

Teşekkürler...

2

Re: RTF'yi rapor (frx) dosyasından yazdırmak mümkün mü?

Tavsiye etmem ama mumkun. Bir rapor yarat "myRTFTest" adinda, ona bir adet Picture\Ole bound kontrol ekle, boyutunu ayarla. Cift klikle ve general field olarak "myRTFHolder.gRTF" yaz (bu isimler asagidaki ornekle ilgili, boyle olmak zorunda degil):
Notlari Turkce'lestirmedim kusura bakma.

Visual Fox Pro
*********************************************************

* You could directly test this code with RTF.dbf located at samples\soultion\ole
*** Report form would have an OleBoundControl with field gRTF
 
* Create a cursor to store Gen field representation of RTF
Create Cursor myRTFHolder (gRTF g)
* Select recs to report into a temp table
* all cursors are written to disk so selecting into a table would do no harm
* Selecting only needed records first to a temp table or cursor has advantages over directly using tables and relations
 
Select Source From _samples+'solution\ole\RTF' ;
  into Cursor RTFReport
 
oForm = Createobject("Form")
oForm.AddObject("myRTF","rtb")
*oForm.Show
With oForm.myRTF
  Scan
    .TextRTF = RTFReport.Source  && Load RTF with memo content
    .SaveFile("myTest.RTF")       && Save to myTest.RTF
    Select myRTFHolder
    Append Blank
    Append General  gRTF From "myTest.RTF" && Append to general field
    Erase myTest.RTF
    *       select TempReport
  Endscan
Endwith
oForm.Release
 
Set Relation To Recno() Into myRTFHolder && Establish one-to-one relation
*modi report myRTFTest
Report Form myRTFTest Preview
* Report form would have an OleBoundControl with field myRTFHolder.gRTF
 
Define Class rtb As OleControl
  OleClass = "RICHTEXT.RichTextCtrl.1"
  OLETypeAllowed = -2
Enddefine