RP2SQL32Lib

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

lagraf
Posts: 452
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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)
...
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

RP2SQL32Lib

Post by leighproman »

#PreviewDlg instead of #rpPrintPreviewDLG if you are using the PreviewDlg class.

Leigh
lagraf
Posts: 452
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

RP2SQL32Lib

Post by leighproman »

Ah, we are using ReportPro2.RpReportRDD{} rather than RpPrinter{} - maybe that is the issue?
lagraf
Posts: 452
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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
User avatar
Chris
Posts: 4961
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post by Chris »

Franz, did you have any problems when you specified NULL_SYMBOL for this param?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
lagraf
Posts: 452
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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)
User avatar
Chris
Posts: 4961
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post by Chris »

Hi Franz,

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

XSharp Development Team
chris(at)xsharp.eu
lagraf
Posts: 452
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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
User avatar
Chris
Posts: 4961
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply