cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports XI - print dialog not open

Former Member
0 Kudos

Good morning

In my Add-Ons I use the Crystal Reports 9 and It works good.

Now I have the necessity to bring up to date for the Crystal Reports XI.

I have already modified the DLL'S and the references and now my add-on already opens reports, but the button to print does not open the box of selection of the printers.

All the other buttons works,but not the button print.

I have SB1 2004A (6.70.193) SP:00 PL:43 and the Add-On is elaborated in the Visual Studio 2003.

Somebody can help me in this issue?

Thank you in advance

Sérgio Sousa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

Still in my problem.

if to substitute the code line:

crxReport.SetDialogParentWindow(a.ToInt32)

for the following one:

crxReport.PrinterSetup(a.ToInt32)

crxReport.PrintOut(False)

the dialog box of the printer selection open before te report Viewer, but the printer button continues not work.

Sérgio Sousa

Former Member
0 Kudos

In my add-on I don't use the print button on the actual viewer, instead invoke the print dialog from the business one print button on the b1 toolbar.

You can easily remove the print button from the viewer form using:

objViewer.EnablePrintButton = False

You could then use your working code (printersetup/printout) and tie these to the B1 menu events for the print / print preview as appropriate. I took this approach to begin with as it offers a much more integrated feel to the application.

John.

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi, I migrated to the Crystal 10 to Crystal XI, but I can not see the SAP toolbar in Crystal XI, do you know why this happen?

The infoview for BOXI Portal works ok.

Lulu

Former Member
0 Kudos

hi john

thanks for your help.

so it was worried about the button of viewer that I did not remember the button of sap.

it is to work perfectly.

Sérgio Sousa

Former Member
0 Kudos

Hi,

I have implemented the same solution using C#. But in my case printing is still not working.

-- Code fragment --

if (menupressed == sbo.sapPrintPage)

{

CRAXDRT.Report rdReport = (CRAXDRT.Report)

crView.ReportSource;

// rdReport.PrinterSetup(winHandle);

rdReport.PrintOut(true, 1, true, 1, 1000);

// crView.PrintReport(); // Initialized ActiveX viewer

}

-- end fragment --

The rdReport.PrinterSetup(winHandle) method is working but the .printOut and the .PrintReport() are not. When I feed wrong parameters into the .PrintOut method a COMException appears, so the COMObject is invoked I think.

Did I miss something?

I welcome any help,

TIA,

Frank.

Former Member
0 Kudos

Have you tried using the <b>SetDialogParentWindow</b> method call mentioned above?

John.

Former Member
0 Kudos

Hi,

Yes I tried this and anything else I could find here and in the Crystal forums.

Thanks for thinking with me here,

Regards,

Frank.

Message was edited by: F. Brouwer

Former Member
0 Kudos

good morning

I continue with this problem.

Somebody can help me in this issue?

already not to know that to make.

Thank you in advance

Sérgio Sousa

Former Member
0 Kudos

hi john

i have this function for open te SAP form with CRview for view the report.

Private Function LoadCrViewer(ByVal crxReport As CRAXDRT.Report) As Boolean

Dim SBOFormCreationParams As SAPbouiCOM.FormCreationParams

Dim SBOCRViewer As SAPbouiCOM.ActiveX

Dim SBOForm As SAPbouiCOM.Form

Dim SBOItem As SAPbouiCOM.Item

Dim strFormCount As String

SBOFormCreationParams = SBOApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)

SBOFormCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable

SBOFormCreationParams.FormType = "XX_INCRPT01"

strFormCount = SBOApplication.Forms.Count.ToString

SBOFormCreationParams.UniqueID = "XX_INCRPT01" & strFormCount.PadLeft(3, "0")

'Add new form

SBOForm = SBOApplication.Forms.AddEx(SBOFormCreationParams)

SBOForm.Left = 0

SBOForm.Top = 0

SBOForm.Width = SBOApplication.Desktop.Width

SBOForm.Height = SBOApplication.Desktop.Height

SBOForm.Title = "inCentea - Mapas"

'Add CRViewer item

SBOItem = SBOForm.Items.Add("XX_CR01", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)

SBOItem.Left = 0

SBOItem.Top = 0

SBOItem.Width = SBOForm.ClientWidth

SBOItem.Height = SBOForm.ClientHeight

' Create the new activeX control

SBOCRViewer = SBOItem.Specific

SBOCRViewer.ClassID = "CrystalReports11.ActiveXReportViewer.1"

SBOCRViewerOBJ = SBOCRViewer.Object

Dim MyProcs() As Process

Dim i, ID As Integer

Dim a As System.IntPtr

'Try Send the handle of SAP window

SBOApplication.Desktop.Title = "SBO under " + SBOApplication.Company.UserName

MyProcs = Process.GetProcessesByName("SAP Business One")

For i = 0 To MyProcs.Length - 1

If MyProcs(i).MainWindowTitle = SBOApplication.Desktop.Title Then

ID = MyProcs(i).Id()

a = MyProcs(i).MainWindowHandle

crxReport.SetDialogParentWindow(a.ToInt32)

End If

Next

SBOCRViewerOBJ.ViewReport()

SBOForm.Visible = True

Return True

End Function

where is the error? the print button dont work!! Dont open the dialog box for select the printer.

i tried the post of john, bat this dont work.

Former Member
0 Kudos

Hi John

how i get de handle of the main Business One application?

He is possivel to send me an example?

Sory, but still I am new in this

Sérgio Sousa

Former Member
0 Kudos

The following posting in the forum shows how to get the window handle:-

John

Former Member
0 Kudos

I encountered the same issue when upgrading to XI recently. I am using the Crystal RDC and got round the problem my calling <b>SetDialogParentWindow</b> on my <b>CRAXDRT.Report</b> object and passing it the window handle of the main Business One application.

John.