-
crystal report: printed report differs from viewer content
Hi. I have written a VB program to allow the user to create reports from
an access database. I am using VB6, sp 5 and crystal reports developer version
8.0. The OS that it is running under is Windows 98, SE. The user chooses
the data fields to include in the report by selecting them from the list
box on the main form.
The snippet of code below then goes through each selection in this list box
on the main form and includes the selected fields in the report. The report
consists of a 2-line column heading and a one-line data field. Some of the
column headings consist of a string followed by a space followed by a number
(ex. “Acct 1”).
On the client’s PC, this shows fine in the crystal report viewer but when
printed, the number does not show. All other column headings show fine.
Even the ones with a space in them.
I have tried this on three other PC’s running windows 98 SE and four different
printers at my office and I can’t recreate this error.
I have tried reloading the print drivers on my client’s PC to no avail.
I have also tried uninstalling and reinstalling my program on the client’s
PC to no avail.
Any help and/or suggestions would be greatly appreciated.
Thanks,
Mike
Snippet of my code to add columns dynamically to my report
==========================================================
For intFieldListIndex = 0 To (frmMainScreen.lstPrintParams.ListCount - 1)
‘If the user has chosen to include this field in the report, then make
a column for this field in the report.
If frmMainScreen.lstPrintParams.Selected(intFieldListIndex) Then
‘add data field from the access database to this report
Set crFldsArray(intFieldsArrayIndex) = crParamsReport.Section3.AddFieldObject("{"
& _
gstrWorkingTableName & "." & strFieldNamesArray(intFieldListIndex) & "}",
_
(lngLastFieldLeftPos + lngLastFieldWidth + intWidthOffset), 0)
‘add row 1 of the column heading to this report
Set crCol1Headings(intFieldsArrayIndex) = _
crParamsReport.Section6.AddTextObject(strCol1HeadingsArray(intFieldListIndex),
_
(lngLastFieldLeftPos + lngLastFieldWidth + intWidthOffset), 0)
‘add row 2 of the column heading to this report
Set crCol2Headings(intFieldsArrayIndex) = _
crParamsReport.Section6.AddTextObject(strCol2HeadingsArray(intFieldListIndex),
_
(lngLastFieldLeftPos + lngLastFieldWidth + intWidthOffset), 0)
‘set column width, font, size and position
Let intWidestColNameWidth = IIf(crCol1Headings(intFieldsArrayIndex).Width
> _
crCol2Headings(intFieldsArrayIndex).Width, crCol1Headings(intFieldsArrayIndex).Width,
_
crCol2Headings(intFieldsArrayIndex).Width)
Let intWidestColNameWidth = IIf(crFldsArray(intFieldsArrayIndex).Width
> _
intWidestColNameWidth, crFldsArray(intFieldsArrayIndex).Width, intWidestColNameWidth)
Let crFldsArray(intFieldsArrayIndex).Width = intWidestColNameWidth
Let crCol1Headings(intFieldsArrayIndex).Width = intWidestColNameWidth
Let crCol2Headings(intFieldsArrayIndex).Width = intWidestColNameWidth
Let crFldsArray(intFieldsArrayIndex).Font.Name = strFontName
Let crFldsArray(intFieldsArrayIndex).Font.Size = intFieldFontSize
Let crFldsArray(intFieldsArrayIndex).Top = intFieldTopPos
Let crFldsArray(intFieldsArrayIndex).Width = crFldsArray(intFieldsArrayIndex).Width
* _
intFieldWidthFactor
Let crCol1Headings(intFieldsArrayIndex).Width = crCol1Headings(intFieldsArrayIndex).Width
* _
intTitleWidthFactor
Let crCol1Headings(intFieldsArrayIndex).Font.Name = strFontName
Let crCol1Headings(intFieldsArrayIndex).Font.Size = intTitleFontSize
Let crCol1Headings(intFieldsArrayIndex).Font.Underline = True
Let crCol1Headings(intFieldsArrayIndex).Font.Bold = False
Let crCol1Headings(intFieldsArrayIndex).Top = intCol1HeadingTopPos
Let crCol1Headings(intFieldsArrayIndex).HorAlignment = crRightAlign
Let crCol2Headings(intFieldsArrayIndex).Width = crCol1Headings(intFieldsArrayIndex).Width
* _
intTitleWidthFactor
Let crCol2Headings(intFieldsArrayIndex).Font.Name = strFontName
Let crCol2Headings(intFieldsArrayIndex).Font.Size = intTitleFontSize
Let crCol2Headings(intFieldsArrayIndex).Font.Underline = True
Let crCol2Headings(intFieldsArrayIndex).Font.Bold = False
Let crCol2Headings(intFieldsArrayIndex).Top = intCol2HeadingTopPos
Let crCol2Headings(intFieldsArrayIndex).HorAlignment = crRightAlign
Let lngLastFieldLeftPos = crFldsArray(intFieldsArrayIndex).Left
Let lngLastFieldWidth = IIf(crCol1Headings(intFieldsArrayIndex).Width
> _
crCol2Headings(intFieldsArrayIndex).Width, crCol1Headings(intFieldsArrayIndex).Width,
_
crCol2Headings(intFieldsArrayIndex).Width)
Let lngLastFieldWidth = IIf(crFldsArray(intFieldsArrayIndex).Width
> _
crCol1Headings(intFieldsArrayIndex).Width, crFldsArray(intFieldsArrayIndex).Width,
_
crCol1Headings(intFieldsArrayIndex).Width)
Let intFieldsArrayIndex = intFieldsArrayIndex + 1
End If
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|