xsharp.eu • RP2SQL32Lib - Page 3
Page 3 of 4

RP2SQL32Lib

Posted: Tue Feb 11, 2020 3:27 pm
by lagraf
Hi Leigh

Code: Select all

oPrinter := RpPrinter{oWindow, SELF}
oPrinter:PrintPreview("Job", "File", "Caption", "Message", TRUE, FALSE, FALSE, SW_SHOWNORMAL, ZOOM_100, #rpPrintPreviewDLG)
gives following error

Code: Select all

Invalid Print Preview Object: RPPRINTPREVIEWDLG
Object of type 'ReportPro2.RpPrinter' cannot be converted to type 'XSharp.__Usual[]'.
CallStack: 
RPTSUMMEN:.CTOR (41)
...

RP2SQL32Lib

Posted: Tue Feb 11, 2020 4:05 pm
by leighproman
#PreviewDlg instead of #rpPrintPreviewDLG if you are using the PreviewDlg class.

Leigh

RP2SQL32Lib

Posted: Wed Feb 12, 2020 5:54 am
by lagraf
Hi Leigh,
and if I want to use standard dialog?
With #PreviewDlg instead of #rpPrintPreviewDlg I get similar message:

Code: Select all

The following error was encountered while reporting: 
Invalid Print Preview Object: PREVIEWDLG
Object of type 'ReportPro2.RpPrinter' cannot be converted to type 'XSharp.__Usual[]'.
CallStack: 
RPTSUMMEN:.CTOR (37)
...

Code: Select all

oPrinter := RpPrinter{oWindow, SELF}
oPrinter:PrintPreview("Job","File","Caption","Mess",TRUE,FALSE,FALSE,SW_SHOWNORMAL,ZOOM_100,#PreviewDLG)
...
CLASS PreviewDlg INHERIT ReportPro2.rpPrintPreviewDlg
METHOD Init(oParent,oPrinter,cCaption,lModal,ptrPlacement,nShowState,lLandScape,nZoom)
SUPER:Init(oParent,oPrinter,cCaption,lModal,ptrPlacement,nShowState,lLandScape,nZoom)
SELF:Caption := cCaption
// here you can delete the default buttons
// and add yours
RETURN SELF
END CLASS

RP2SQL32Lib

Posted: Wed Feb 12, 2020 11:42 am
by leighproman
Ah, we are using ReportPro2.RpReportRDD{} rather than RpPrinter{} - maybe that is the issue?

RP2SQL32Lib

Posted: Wed Feb 12, 2020 3:21 pm
by lagraf
My ReportProRDD and ReportProSQL reports are not the problem, they do well.
This is a problem using RpPrinter, you see it in the class init and in the error message.
Franz

RP2SQL32Lib

Posted: Wed Feb 12, 2020 7:09 pm
by Chris
Franz, did you have any problems when you specified NULL_SYMBOL for this param?

RP2SQL32Lib

Posted: Thu Feb 13, 2020 8:23 am
by lagraf
Hi Chris,
if I use NULL_SYMBOL rpPrinter crashes with

Code: Select all

The following error was encountered while reporting: 
Invalid Print Preview Object: 
Object of type 'ReportPro2.RpPrinter' cannot be converted to type 'XSharp.__Usual[]'.
CallStack: 
RPTSUMMEN:.CTOR (36)
...
If I use #rpPrintPreviewDlg the message is nearly the same

Code: Select all

The following error was encountered while reporting: 
Invalid Print Preview Object: RPPRINTPREVIEWDLG
Object of type 'ReportPro2.RpPrinter' cannot be converted to type 'XSharp.__Usual[]'.
CallStack: 
RPTSUMMEN:.CTOR (37)

RP2SQL32Lib

Posted: Thu Feb 13, 2020 12:17 pm
by Chris
Hi Franz,

It is a little strange judging from the error message. Can you please show us your exact code?

RP2SQL32Lib

Posted: Thu Feb 13, 2020 12:53 pm
by lagraf

Code: Select all

LOCAL oPrinter AS RpPrinter
oPrinter := RpPrinter{oWindow, SELF}
IF oPrinter:IsValid
	oPrinter:Landscape := FALSE
	oPrinter:UnitOfMeasure := UNIT_MM
	oPrinter:BottomMargin := 0
	oPrinter:LeftMargin := 0
	oPrinter:RightMargin := 0
	oPrinter:TopMargin := 0
	oPrinter:NoPageNums := TRUE
	oPrinter:NoSelection := TRUE
	oPrinter:SetFont("Arial", 10, FALSE, FALSE, FALSE)
	oPrinter:SetPrinterByName("SCREEN", "")
	oPrinter:PaperSize := DMPAPER_A4
	oPrinter:PrintPreview("Tagessummen", "SUMMEN.PRN", "Tagessummen", "Ausdruck in Bearbeitung ...", TRUE, FALSE, FALSE, SW_SHOWNORMAL, ZOOM_100, NULL_SYMBOL)
ENDIF

RP2SQL32Lib

Posted: Thu Feb 13, 2020 5:49 pm
by Chris
Hi Franz,

So the line 36 (and 37 in the other error message) that is mentioned in the callstack is the line that contains the call to PrintPreview()? Or is it pointing somewhere else?

I tested your exact code with a test report of mine and it seems to be working fine here. This means that the problem is happening due to some other part of the code that we do not see, or that this is not causing a problem anymore because of the many fixes I have made in our internal version. I will send you tonight our newest version of RP2, hope it fixes the problem. If not, please provide a full compileable sample that reproduces the error.