Hi. As the subjects says, that's what I'm trying to acheive using THIS code...
Method PrintInvoice Class JobInfo
local oDB as DBServer
Local CCode, cName, cPrint2Filename, cCaption, cMessage, cJobName, nJobNUmber //as string
Local oReport as RpReport
nJobNUmber := self:oSFJobInfo_DETAIL:JOBNUMBER
cName := self:CLNAME
self:Hide()
oDB := self:oSFJobInfo_DETAIL:Server
oDB:Commit()
cJobName := "Current Jobs Listing"
cPrint2Filename := "Invoice Number " + self:oSFJobInfo_DETAIL:JOBNUMBER + " For " + Proper(cName) + ".pdf" <== This is what I want the report (Invoice in this case) to be called. Not the PDF extension.
cCaption := cAppVersion + " - Report Preview"
cMessage := "Printing in progress..."
oReport := RpReport{ self, "JobNumber.rpt"}
IF oReport:IsValid
oDB:SetOrder("JobNumber", "Details")
oDB:GoTop()
oDB:Seek(nJobNUmber)
CCode := oDB:FIELDGET(#CLCode)
oDB:Close()
oDB := CLIENT{self}
oDB:Seek( AllTrim(CCode))
cName := oDB:FIELDGET(#ClName)
oDB:Close()
oReport:SetVariableValue("ClientHeading", "TAX Invoice " + nJobNUmber)
oReport:SetVariableValue("CCode", AllTrim(CCode))
oReport:SetVariableValue("CName", AllTrim(cName) )
oReport:SetVariableValue("IsFin", .F.)
oReport:PrintPreview(cJobName,cPrint2Filename,cCaption,cMessage,,SW_SHOWMAXIMIZED)
self:Pointer := Pointer{ POINTERARROW }
ENDIF
oDB:Close()
oReport:Close()
self:Show(SHOWCENTERED)
Return nil
The <== are comments to help you understand what I'm doing
Any ideas please?
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Hi Jeff,
?Compiler error => Show us the compiler error
?What does it actually show
Regards,
BiggyRat wrote:Hi. As the subjects says, that's what I'm trying to acheive using THIS code...
Code: Select all
Method PrintInvoice Class JobInfo
local oDB as DBServer
Local CCode, cName, cPrint2Filename, cCaption,
cMessage, cJobName, nJobNUmber //as string
Local oReport as RpReport
nJobNUmber := self:oSFJobInfo_DETAIL:JOBNUMBER
cName := self:CLNAME
self:Hide()
oDB := self:oSFJobInfo_DETAIL:Server
oDB:Commit()
cJobName := "Current Jobs Listing"
cPrint2Filename := "Invoice Number " + self:oSFJobInfo_DETAIL:JOBNUMBER + ;
" For " + Proper(cName) + ".pdf" // <==
cCaption := cAppVersion + " - Report Preview"
cMessage := "Printing in progress..."
oReport := RpReport{ self, "JobNumber.rpt"}
IF oReport:IsValid
oDB:SetOrder("JobNumber", "Details")
oDB:GoTop()
oDB:Seek(nJobNUmber)
CCode := oDB:FIELDGET(#CLCode)
oDB:Close()
oDB := CLIENT{self}
oDB:Seek( AllTrim(CCode))
cName := oDB:FIELDGET(#ClName)
oDB:Close()
oReport:SetVariableValue("ClientHeading", "TAX Invoice " + nJobNUmber)
oReport:SetVariableValue("CCode", AllTrim(CCode))
oReport:SetVariableValue("CName", AllTrim(cName) )
oReport:SetVariableValue("IsFin", .F.)
oReport:PrintPreview(cJobName,cPrint2Filename,;
cCaption,cMessage,,SW_SHOWMAXIMIZED)
self:Pointer := Pointer{ POINTERARROW }
ENDIF
oDB:Close()
oReport:Close()
self:Show(SHOWCENTERED)
Return nil
As stated previously, yes have ideas, but why don't you achieve this?The <== This is what I want the report (Invoice in this case) to be called. Not the PDF extension to help you understand what I'm doing
Any ideas please?
?Compiler error => Show us the compiler error
?What does it actually show
Regards,
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
I think we have a language issue here Johan, sorry. There is no compiler error. I want to know how to write the produced invoice to a file names as I specified.
As stated previously, yes have ideas, but why don't you achieve this?
Makes no sense to.me at all I'm.afraid.
As stated previously, yes have ideas, but why don't you achieve this?
Makes no sense to.me at all I'm.afraid.
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Hi Jeff,
Ok I do understand your problem, you don't want to show the preview, you want to print immediately to file...
Here is the basics of how I use Report Pro to write output to a TextFile in a data-driven environment, am sure you should be able to do the same to a PDF dumping the PDF stream:
Is that answering your question?
Ok I do understand your problem, you don't want to show the preview, you want to print immediately to file...
BiggyRat wrote:Hi. As the subjects says, that's what I'm trying to acheive using THIS code...
Code: Select all
oReport:PrintPreview(cJobName,cPrint2Filename,;
cCaption,cMessage,,SW_SHOWMAXIMIZED)
Code: Select all
CLASS DDE_RepPro INHERIT Dict
PROTECT ptrPrintFile AS PTR
METHOD Exec(cStream) CLASS DDE_Report
SELF:ptrPrintFile := FCreate2(cOutput, FC_NORMAL)
FClose(SELF:ptrPrintFile)
SELF:ptrPrintFile := FOpen2(cOutput, FO_READWRITE + FO_EXCLUSIVE)
IF SELF:ptrPrintFile # F_ERROR
FSeek(ptrPrintFile, 0, iif(lAppend, FS_END, FS_SET))
FWrite(SELF:ptrPrintFile, cStream)
FClose(SELF:ptrPrintFile)
ENDIF
RETURN SELF
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Here is the code I believe you need to adapt to your :PrintPreview call:
Good luck!
Code: Select all
IF symAction = #PREVIEW
SELF:oPrinter:PrintPreview( SELF:cReportTitle, ;
SELF:cReportTitle + ".PRN", SELF:cReportTitle, "Printing...")
ELSE
SELF:oPrinter:Print( SELF:cReportTitle, ;
SELF:cReportTitle + ".PRN", SELF:cReportTitle, "Printing...",FALSE,FALSE)
ENDIF
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Yes, I think that may do it Johan. Thank you very much for your help.
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Hi Jeff,
The RPViewer can be setup to have a printer for printing, which is just a printing device, e.g. PdfCreator. You just need to hook onto that, I just took it a bit further, strip the "Text" out a RP report and dump it to a textfile, or you can also dump it in a HTML file with references to the Graphics parts sitting on a shared webserver. There are plenty of options.
In .net, you can hook a RP .rpt file and use the .net PrintPreview class to simulate exactly the way ReportPro works. Done it, it is just not user friendly. I should maybe look at creating a Designer UI around my code as alternative to RP... Any volunteers to assist?
The RPViewer can be setup to have a printer for printing, which is just a printing device, e.g. PdfCreator. You just need to hook onto that, I just took it a bit further, strip the "Text" out a RP report and dump it to a textfile, or you can also dump it in a HTML file with references to the Graphics parts sitting on a shared webserver. There are plenty of options.
In .net, you can hook a RP .rpt file and use the .net PrintPreview class to simulate exactly the way ReportPro works. Done it, it is just not user friendly. I should maybe look at creating a Designer UI around my code as alternative to RP... Any volunteers to assist?
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Hello Jeff,
I think you simple mean this:
CASE oPRT:nDestination==3 // print to file
DO CASE
CASE oPRT:cKindOfFile=="1" // ASCII
oReport:PrintExport(cCaption,cMessage,#RP_ASCII,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="2" // HTML
oReport:PrintExport(cCaption,cMessage,#RP_HTML,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="3" // WORD95
oReport:PrintExport(cCaption,cMessage,#RP_RTF_WORD95,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="4" // WORD97
oReport:PrintExport(cCaption,cMessage,#RP_RTF_WORD97,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="5" // EXCEL
oReport:PrintExport(cCaption,cMessage,#RP_EXCEL,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="6" // pdf
oReport:PrintExport(cCaption,cMessage,#RP_PDF,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="7" // email
oReport:PrintExport(cCaption,cMessage,#RP_PDF,oPRT:ToFileFS:FullPath)
I can mail you the whole method I use if you like.
For PDF prints make sure you include a RpWin.ini file in the program directory with a section like below as e.g. without embedded fonts a non standard font won't display and with embedded fonts (value = 1) your PDF files are much larger.
Dick
[PDFOutPut]
Title=Title
Subject=Subject
Author=Author
Keywords=Keywords
Creator=Application
Compressed=1
EmbedFonts=1
I think you simple mean this:
CASE oPRT:nDestination==3 // print to file
DO CASE
CASE oPRT:cKindOfFile=="1" // ASCII
oReport:PrintExport(cCaption,cMessage,#RP_ASCII,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="2" // HTML
oReport:PrintExport(cCaption,cMessage,#RP_HTML,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="3" // WORD95
oReport:PrintExport(cCaption,cMessage,#RP_RTF_WORD95,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="4" // WORD97
oReport:PrintExport(cCaption,cMessage,#RP_RTF_WORD97,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="5" // EXCEL
oReport:PrintExport(cCaption,cMessage,#RP_EXCEL,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="6" // pdf
oReport:PrintExport(cCaption,cMessage,#RP_PDF,oPRT:ToFileFS:FullPath)
CASE oPRT:cKindOfFile=="7" // email
oReport:PrintExport(cCaption,cMessage,#RP_PDF,oPRT:ToFileFS:FullPath)
I can mail you the whole method I use if you like.
For PDF prints make sure you include a RpWin.ini file in the program directory with a section like below as e.g. without embedded fonts a non standard font won't display and with embedded fonts (value = 1) your PDF files are much larger.
Dick
[PDFOutPut]
Title=Title
Subject=Subject
Author=Author
Keywords=Keywords
Creator=Application
Compressed=1
EmbedFonts=1
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
That would be awesome Dick thank you very much. I'll go with what you've posted here to start, but if I could see the whole method, that would no doubt help me a lot more. Thank you again.
Printing a ReportPro 2.17 report to a file from a VO 2.8SP3 app.
Hello Jeff,
Just mailed it.
Dick
Just mailed it.
Dick