cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: "PrintOptions.CustomPaperSource" lost when calling "DataDefinition.FormulaFields.Find"

patrick_simons2
Participant
0 Kudos

Hi Don,

I ran across a strange problem. Our customer uses a Canon iR3235/iR3245 PCL5e printer driver with 4 trays. Everything's running well except when selecting Drawer 4 (Id=264), the printer switches to Auto. The other trays are working well as they are standard-trays as upper or lower... (I think so)

The problem comes, when a formula Check is used between configuring the printer and printing.

Here a sample code:

With _crystalMainReport.PrintOptions                
    Using pd As System.Drawing.Printing.PrintDocument = New System.Drawing.Printing.PrintDocument()
                    pd.PrinterSettings.PrinterName = printerName
                    For Each ps As System.Drawing.Printing.PaperSource In pd.PrinterSettings.PaperSources
                        If ps.RawKind = .PaperSource Then
                            .CustomPaperSource = New System.Drawing.Printing.PaperSource()
                            .CustomPaperSource.SourceName = ps.SourceName.Trim
                            .CustomPaperSource.RawKind = ps.RawKind
                            Exit For
                        End If
                    Next
    End Using
End With

'   the problem code
_crystalMainReport.ReportClientDocument.DataDefinition.FormulaFields.Find("Test", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault)


' Check
With _crystalMainReport.PrintOptions                
                    Dim message As String = "PrinterSelectConfig" & vbCrLf &
                                            " - Printername: " & .PrinterName & vbCrLf &
                                            " - Duplex:      " & .PrinterDuplex.ToString & vbCrLf &
                                            " - Source:      " & .PaperSource.ToString & vbCrLf
                    If .CustomPaperSource Is Nothing Then
                        message &= "    RawKind:     (not defined)" & vbCrLf
                    Else
                        message &= "    RawKind:     " & .CustomPaperSource.RawKind.ToString & " (" & .CustomPaperSource.SourceName & ")" & vbCrLf
                    End If
                    message &= " - Orientation: " & .PaperOrientation.ToString & vbCrLf &
                               " - Papersize:   " & .PaperSize.ToString
                    MessageBox.Show(message, "Debug", MessageBoxButtons.OK, MessageBoxIcon.Information)                
End With

When you comment out "FormulaFields.Find", it works well, RawKind is set. With the Find, CustomPaperSource becomes Nothing.

Both logics have nothing to do with each other, but seems nevertheless to have an influence....

BTW. I use SP18.

Patrick

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Turned out to be a work flow problem, Set printer info and then change the report reset the printer properties.

Answers (2)

Answers (2)

patrick_simons2
Participant
0 Kudos

Yes, you have to configure the additional trays in the printer driver:

I can reproduce the problem on Windows 7, Windows 8.1, .... I have not tried Windows 10.

I don't think that the report matters, I'll tried different reports - same behavior.

I'll send you additional info by mail.

Thanks,

Patrick

0 Kudos

Hi Patrick,

That's odd I installed the printer and I don't see Tray 4 or one with that high of an ENUM, but after some configuring I now see it:

I'm on Windows 10, what OS are they using?

Can you get the config screen shots from that printer?

Can you verify the report? If something is wrong with their formula it's possible CR is simply resetting all changes

I believe you have my e-mail, send me the report so I can check it, since this new piece of @#$# no longer allows you to attached renamed RPT file.

Don