$cdevice = kDevRtf

Paul Mulroney pmulroney at logicaldevelopments.com.au
Wed Apr 14 02:11:53 UTC 2021


Hi Mike,

We have done this in the past with older versions of Omnis.  You don't need to do the $cdevice.$open() and $close.

We also found that the RTF header produced by Omnis is technically RTF, but it's nowhere near what Microsoft produces if you create a blank RTF document. We needed our report to print landscape, and it just wouldn't do it, so we would create the file and then find/replace in the RTF headers where it had the paper sizes to reset the page to be landscape.  RTF files are straight ASCII, so it is possible to read and understand them.

Our bit of code looks like this:

Prompt for destination
If flag true     ;; User clicked OK
	If $cdevice().$name='PDF'     ;; If we're sending to PDF, then prompt for name
		; stuff deleted for clarity
	Else If $cdevice().$name='RTF'     ;; Same for RTF
		Calculate vsOutputPath as con(sys(80),'.rtf')     ;; Default to the name of the report with RTF appended.
		Do FileOps.$putfilename(vsOutputPath,'Save Report','*.rtf') 
		If vsOutputPath<>''
			Do $cdevice.$setparam(kDevRtfFileName,vsOutputPath)
		End If
	End If
End If

Print report {* (pList,pParam1,pParam2,pParam3,pParam4)}
If pos($cdevice().$name,'RTF PDF File')<>0     ;; Currently set to RTF or Postscript output
	Send to page preview      ;; Reset back to Page Preview (what was screen) output. closes output file at the same time
End If



> On 14 Apr 2021, at 3:33 am, Mike Matthews - Omnis <omnis at lineal.co.uk> wrote:
> 
> Hello All,
> 
> I’m trying to save a report as type RTF.  No real success, the report is garbage when opened up in Word for example.  Word makes, saves and opens RTF files ok.
> 
> pParaRow.FilePath is a proper path, and the file arrives in the right place with the right name.
> 
> Calculate $cdevice as kDevRtf
> Do $cdevice.$setparam(kDevRtfFileName,pParaRow.FilePath)
> Do $cdevice.$open()
> 
> Set report name [pParaRow.ReportClassName]
> Print report * (pReportList,pParaRow)
> 
> Do $cdevice.$close()
> 
> So, does anyone know how to print an RTF report please?
> 
> Thanks
> 
> Mike Matthews
> 
> Lineal Software Solutions
> Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>
> 
> omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>
> 
> www.lineal.co.uk<http://www.lineal.co.uk/>
> 
> www.sqlworks.co.uk<http://www.sqlworks.co/>
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 




  <https://www.logicaldevelopments.com.au/>	Paul W Mulroney
Logical Developments
Customised Software Solutions
Ph: 08 9458 3889
 	We Don't Do Simple Pty Ltd
trading as
Logical Developments
ACN 161 009 374
 	  <https://www.facebook.com/logicaldevelopmentswa/>   <https://twitter.com/WeDontDoSimple>   <https://www.linkedin.com/company/logicaldevelopments/>   <https://www.youtube.com/channel/UCPldVVgWR05WX3cVrR5WUQw>


More information about the omnisdev-en mailing list