Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 17, 2017 at 10:39 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 21, 2016 at 04:00 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 23, 2016 at 10:42 AM

    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

    Add comment
    10|10000 characters needed characters exceeded