DandL
asked on
Printing issue with saved CR7 file
I am using the Crystal 7 runtime file in a home ground application. When I print a saved Crystal Report some pages pint bad data. This happens in the page header b section. My page header b represents that table columns in the database. The names are not hard coded, but change with the database that is being used.
This is what happens: If I run a report from scratch it looks and prints correctly. If I save that report it will open and all data looks correct, but when I print it several of the pages print bad information.
What I mean by bad information is this:
The column names will print on top of each other, or instead of printing the word 'Date' it might print 'D e' [leaving out the 'a' and 't']. Or it might print the whole word Date so that all the letters are printed on top of each other.
It is odd because it will not do this with every page of the report. It might just do it on page one and page 5 of a 10 page report, and all the other pages print correctly.
This only happens if we open a crystal report in our application. If we open it up in the crystal report designer it will print correctly.
Do you have any thoughts as to why this might be?
This is what happens: If I run a report from scratch it looks and prints correctly. If I save that report it will open and all data looks correct, but when I print it several of the pages print bad information.
What I mean by bad information is this:
The column names will print on top of each other, or instead of printing the word 'Date' it might print 'D e' [leaving out the 'a' and 't']. Or it might print the whole word Date so that all the letters are printed on top of each other.
It is odd because it will not do this with every page of the report. It might just do it on page one and page 5 of a 10 page report, and all the other pages print correctly.
This only happens if we open a crystal report in our application. If we open it up in the crystal report designer it will print correctly.
Do you have any thoughts as to why this might be?
ASKER
We have been able to rule out the printer. There are over 1000 printers and every printer we have tried produces the same results.
Any other ideas?
Any other ideas?
Does the report use a fancy font that might not be loaded on your printer. I have seen problems with some fonts that act somewhat like that at times. Usually though it happens on all records or headers not just some.
Are some of the headers suppressed conditionally?
What code are you using to print the report from the application?
mlmcc
Are some of the headers suppressed conditionally?
What code are you using to print the report from the application?
mlmcc
Just a wild thought, but sometimes gives desired result.
what I guess from your problem description you are using
crystal report standard format. and as your page header b gets the information from database (which is changing also)
instead of placing the database fields in page header b use formula which will just be the names of the database fields and place them accordingly.Keep enough space for the formulae field.
Also use normal font like arial, times new roman etc and check for printer driver.
Best of luck
what I guess from your problem description you are using
crystal report standard format. and as your page header b gets the information from database (which is changing also)
instead of placing the database fields in page header b use formula which will just be the names of the database fields and place them accordingly.Keep enough space for the formulae field.
Also use normal font like arial, times new roman etc and check for printer driver.
Best of luck
ASKER
ASKER
mlmcc
>Does the report use a fancy font that might not be loaded on your printer.
No. Some pages print correctly and some do not.
>Does the report use a fancy font that might not be loaded on your printer.
No. Some pages print correctly and some do not.
ASKER
kzdera
I miss wrote in my first post. I said:
"The names are not hard coded, but change with the database that is being used. "
I was wrong the column names are hard coded.
I miss wrote in my first post. I said:
"The names are not hard coded, but change with the database that is being used. "
I was wrong the column names are hard coded.
ASKER
This is(a very small part of) the code we are using in our application. It is probably more detail then you wanted but here it is.
'this is what we are using to print the report
Private Sub mnuFilePrint_Click()
On Error GoTo ProcError
If (TypeOf mdiMain.ActiveForm Is frmReport) Or _
(TypeOf mdiMain.ActiveForm Is frmReportViewer) Then
'just using printreport
mdiMain.ActiveForm.PrintRe port
End If
Call UpdateStatusBar("")
ProcExit:
Exit Sub
ProcError:
Teradata.DisplayError False, App, "mnuFilePrint_Click", "Unknown report type: Cannot print this type of report"
End Sub
'this is what we are using to print the report
Private Sub mnuFilePrint_Click()
On Error GoTo ProcError
If (TypeOf mdiMain.ActiveForm Is frmReport) Or _
(TypeOf mdiMain.ActiveForm Is frmReportViewer) Then
'just using printreport
mdiMain.ActiveForm.PrintRe
End If
Call UpdateStatusBar("")
ProcExit:
Exit Sub
ProcError:
Teradata.DisplayError False, App, "mnuFilePrint_Click", "Unknown report type: Cannot print this type of report"
End Sub
ASKER
'this is print
Public Sub PrintReport()
On Error GoTo ProcError
Select Case menumReportType
Case daRVTAnalyzer
Me.Analyzer.PrintGrid
Case daRVTCrystalReport, _
daRVTCrystalChart
Call vwrCrystalViewer_PrintButt onClicked( False)
End Select
Exit Sub
ProcError:
mdiMain.Teradata.DisplayEr ror False, App, "PrintReport", "An error occurred while printing the report."
End Sub
Public Sub PrintReport()
On Error GoTo ProcError
Select Case menumReportType
Case daRVTAnalyzer
Me.Analyzer.PrintGrid
Case daRVTCrystalReport, _
daRVTCrystalChart
Call vwrCrystalViewer_PrintButt
End Select
Exit Sub
ProcError:
mdiMain.Teradata.DisplayEr
End Sub
ASKER
ASKER
Private Sub vwrCrystalViewer_PrintButt onClicked( UseDefault As Boolean)
Dim CRApp As CRAXDRT.Application
Dim rp As CRAXDRT.Report
UseDefault = False
Set CRApp = New CRAXDRT.Application
Set rp = CRApp.OpenReport(mstrFileN ame, crOpenReportByTempCopy)
mdiMain.PrintCrystalReport Me.hwnd, _
mobjReportObject, _
Me.vwrCrystalViewer.GetCur rentPageNu mber, _
Me.vwrCrystalViewer.GetCur rentPageNu mber, _
False
Set rp = Nothing
Set CRApp = Nothing
End Sub
Dim CRApp As CRAXDRT.Application
Dim rp As CRAXDRT.Report
UseDefault = False
Set CRApp = New CRAXDRT.Application
Set rp = CRApp.OpenReport(mstrFileN
mdiMain.PrintCrystalReport
mobjReportObject, _
Me.vwrCrystalViewer.GetCur
Me.vwrCrystalViewer.GetCur
False
Set rp = Nothing
Set CRApp = Nothing
End Sub
ASKER
'Set up printer and print
Public Sub PrintCrystalReport(hWndOwn er As Long, _
rptReport As CRAXDRT.Report, _
Optional ByVal FromPage As Integer = 1, _
Optional ByVal ToPage As Integer = 1, _
Optional ByVal DiscardSavedData As Boolean = True)
Dim intButtonPressed As Integer
Dim intDefaultPrinterIndex As Integer
'Static sblnBusy As Boolean
On Error GoTo ErrorHandler
If Not mblnPrintingCrystalReport Then
mblnPrintingCrystalReport = True
SetMousePointer vbHourglass
Call MaintainMenus
' Save the index of the current default printer
Printer.TrackDefault = True
For intDefaultPrinterIndex = 0 To Printers.Count - 1
If Printer.DeviceName = Printers(intDefaultPrinter Index).Dev iceName Then
Exit For
End If
Next intDefaultPrinterIndex
' Set default printer settings of the GLOBAL Printer object based on
' the custom settings for the report view in rptReport
With Printer
.Orientation = rptReport.PaperOrientation
.PaperSize = rptReport.PaperSize
.Copies = 1
.Duplex = vbPRDPSimplex
.ColorMode = vbPRCMMonochrome
End With
SetMousePointer vbDefault
intButtonPressed = ChoosePrinter(hWndOwner, _
cdlPDPageNums Or cdlPDNoSelection, _
FromPage, _
ToPage, _
, _
1)
If intButtonPressed <> DLG_CANCEL Then
If intButtonPressed = DLG_ERROR Then
MsgBox "Unable to show the printer dialog box. The default printer will be used.", vbExclamation, "Print"
End If
'SetMousePointer vbHourglass
SetMousePointer vbArrowHourglass
UpdateStatusBar ("Printing current report view...")
' Set rptReport's printer settings (where applicable) equal to the settings in the
' global Printer object, which might have been changed by the user via the common
' Print dialog
With rptReport
If DiscardSavedData Then
.DiscardSavedData
End If
.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port
.PaperOrientation = Printer.Orientation
.PaperSize = Printer.PaperSize
If (FromPage Or ToPage) = 0 Then
.PrintOut IIf(intButtonPressed = DLG_ERROR, True, False), IIf(Printer.Copies = 0, 1, Printer.Copies)
Else
.PrintOut IIf(intButtonPressed = DLG_ERROR, True, False), IIf(Printer.Copies = 0, 1, Printer.Copies), , FromPage, ToPage
End If
End With
' Reset Printer object back to what it was originally
Set Printer = Printers(intDefaultPrinter Index)
End If
mblnPrintingCrystalReport = False
Else
Beep
MsgBox "VISTA is busy printing the current report view. Please try again later.", vbOKOnly + vbExclamation, "VISTA Reporting System - Print"
End If
ProcExit:
SetMousePointer vbDefault
Call MaintainMenus
UpdateStatusBar ("")
Exit Sub
ErrorHandler:
If Not Teradata Is Nothing Then
Teradata.DisplayError False, App, "PrintCrystalReport", "VISTA was unable to print this report. " & _
"You may try selecting a different paper size, orientation, " & _
"or another printer before trying to print again."
Else
MsgBox "VISTA was unable to print this report." & vbCrLf & vbCrLf & "The following error occurred:" & _
vbCrLf & vbCrLf & Err.Number & " " & Err.Description, vbExclamation, "Print"
End If
mblnPrintingCrystalReport = False
Resume ProcExit
End Sub
Public Sub PrintCrystalReport(hWndOwn
rptReport As CRAXDRT.Report, _
Optional ByVal FromPage As Integer = 1, _
Optional ByVal ToPage As Integer = 1, _
Optional ByVal DiscardSavedData As Boolean = True)
Dim intButtonPressed As Integer
Dim intDefaultPrinterIndex As Integer
'Static sblnBusy As Boolean
On Error GoTo ErrorHandler
If Not mblnPrintingCrystalReport Then
mblnPrintingCrystalReport = True
SetMousePointer vbHourglass
Call MaintainMenus
' Save the index of the current default printer
Printer.TrackDefault = True
For intDefaultPrinterIndex = 0 To Printers.Count - 1
If Printer.DeviceName = Printers(intDefaultPrinter
Exit For
End If
Next intDefaultPrinterIndex
' Set default printer settings of the GLOBAL Printer object based on
' the custom settings for the report view in rptReport
With Printer
.Orientation = rptReport.PaperOrientation
.PaperSize = rptReport.PaperSize
.Copies = 1
.Duplex = vbPRDPSimplex
.ColorMode = vbPRCMMonochrome
End With
SetMousePointer vbDefault
intButtonPressed = ChoosePrinter(hWndOwner, _
cdlPDPageNums Or cdlPDNoSelection, _
FromPage, _
ToPage, _
, _
1)
If intButtonPressed <> DLG_CANCEL Then
If intButtonPressed = DLG_ERROR Then
MsgBox "Unable to show the printer dialog box. The default printer will be used.", vbExclamation, "Print"
End If
'SetMousePointer vbHourglass
SetMousePointer vbArrowHourglass
UpdateStatusBar ("Printing current report view...")
' Set rptReport's printer settings (where applicable) equal to the settings in the
' global Printer object, which might have been changed by the user via the common
' Print dialog
With rptReport
If DiscardSavedData Then
.DiscardSavedData
End If
.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port
.PaperOrientation = Printer.Orientation
.PaperSize = Printer.PaperSize
If (FromPage Or ToPage) = 0 Then
.PrintOut IIf(intButtonPressed = DLG_ERROR, True, False), IIf(Printer.Copies = 0, 1, Printer.Copies)
Else
.PrintOut IIf(intButtonPressed = DLG_ERROR, True, False), IIf(Printer.Copies = 0, 1, Printer.Copies), , FromPage, ToPage
End If
End With
' Reset Printer object back to what it was originally
Set Printer = Printers(intDefaultPrinter
End If
mblnPrintingCrystalReport = False
Else
Beep
MsgBox "VISTA is busy printing the current report view. Please try again later.", vbOKOnly + vbExclamation, "VISTA Reporting System - Print"
End If
ProcExit:
SetMousePointer vbDefault
Call MaintainMenus
UpdateStatusBar ("")
Exit Sub
ErrorHandler:
If Not Teradata Is Nothing Then
Teradata.DisplayError False, App, "PrintCrystalReport", "VISTA was unable to print this report. " & _
"You may try selecting a different paper size, orientation, " & _
"or another printer before trying to print again."
Else
MsgBox "VISTA was unable to print this report." & vbCrLf & vbCrLf & "The following error occurred:" & _
vbCrLf & vbCrLf & Err.Number & " " & Err.Description, vbExclamation, "Print"
End If
mblnPrintingCrystalReport = False
Resume ProcExit
End Sub
ASKER
Sorry for so many posts but I keep geting an error when I tried to post everything at once.
DandL
DandL
ASKER
Ok, I think I might have figuard out what is going on. If my text object has a return char in it or if the text object contains text that requires more than one line, it produces the bad text on the first page. Have y'all run into that before?
Try setting the 'can grow' property on the fields in question so that any additional information will expand the field.
I had a similar, but not exact problem, and I believe this solved it for me.
hth.
Wileecoy.
I had a similar, but not exact problem, and I believe this solved it for me.
hth.
Wileecoy.
Sorry you have had problems; our Engineering team is working diligently to correct the problem and intermittent outages you've experienced. Working on the solution as I type this for Milestone Release 3.0.1, noted in "What's New".
Your patience and understanding is appreciated.
:)
Moondancer - EE Moderator
Your patience and understanding is appreciated.
:)
Moondancer - EE Moderator
ASKER
wileecoy,
I tried the can grow but that did not seem to work.
Any other ideas?
I tried the can grow but that did not seem to work.
Any other ideas?
ASKER
>I tried the can grow but that did not seem to work.
Well it worked but did not solve me issue.
Well it worked but did not solve me issue.
The only other thing that I can think of is to e-mail it to me and see if I can use it.
If you want to - WileecoyForEE@AOL.com
hth.
Wileecoy.
If you want to - WileecoyForEE@AOL.com
hth.
Wileecoy.
If the field taht is too large or must grow has fields under it the other fields won't move down the page. A field that grows must (in my experience) be the last field in a section.
If you have data after the field in question, add a new detail field below the current one and copy/move the fields down. In that way the detail section will grow as required then the next detail section will start.
good luck
mlmcc
If you have data after the field in question, add a new detail field below the current one and copy/move the fields down. In that way the detail section will grow as required then the next detail section will start.
good luck
mlmcc
ASKER
Well this is what we found out....though we did not figure out why it was happening.
We found that every page of the cr that we view before printing becomes corrupted. All we did to fix the problem is when the user hits 'print' we just open the CR again and then print it. And all works well.
Thanks for your help.
We found that every page of the cr that we view before printing becomes corrupted. All we did to fix the problem is when the user hits 'print' we just open the CR again and then print it. And all works well.
Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
good luck
mlmcc