Oblige C1Flexreport to use the giving print parameter in VB code

Posted by: saidnai on 14 September 2018, 9:36 am EST

    • Post Options:
    • Link

    Posted 14 September 2018, 9:36 am EST

    Dear All,

    I still have problems with the C1FlexReport in regard of printing. I need to force the C1Flexreport with VB code to print the format and the size according to the requierements.

    Problems:

    1. I do not get what i see in the Flexviewer.
    2. I choose landscape it will be printed Portrait virsus the same and all the Parameter are others.
      
    3. I change to papersize custom/customwidth/customheight no way
      
    4. i do not understand the values under customwidth and 	customheight (cm,mm,in, etc...) they are others like showing in the Layout line.
      
    5. Printing from the Flexviewer is ok but printing from a button with you get what you don not see.
      
    6. Did the .flxr save the original Parameters like printer name, papersize, Height, width, etc…

    So please how to ovoide all this non sens and get a great Report

    without loosing 2 weeks coding and trying. In the past i have already post about it. There was a bug forwarder to the responsible persons.

    Best regards

    Said

  • Posted 17 September 2018, 3:11 am EST

    Hi Said,

    we found out that we have to do the following to assign e.g. landscape/portrait mode to a C1FlexReport:

    You need to create a “PageSettings” object, then assign it to C1FlexReport:

    
            PageSettings myPageSettings = ...;
            C1PageSettings pageSettingsC1 = new C1PageSettings();
            pageSettingsC1.AssignFrom(myPageSettings );
            myFlexReport.PageSettings = pageSettingsC1;
    
    

    If you want to do a direct print, without using the C1FlexViewer control, you have to assing the page settings this way:

    
            myFlexReport.DefaultPrintOptions.PageSettings = myPageSettings;
    
    

    Hope this helps

    Wolfgang

  • Posted 17 September 2018, 4:51 am EST

    Hello Said,

    It seems that you wish to change the orientation, papersize and printer name at runtime for a C1FlexReport. For this, you can use the below mentioned code snippet, where an instance of C1PrintOptions is used:

    ```

    Dim options As New C1PrintOptions()

    options.PrinterSettings = New PrinterSettings()

    options.PageSettings = New PageSettings()

    'Orientation

    options.PageSettings.Landscape = True

    'Set custom paper size

    c1FlexReport1.PageSettings.PaperSize = PaperKind.Custom

    c1FlexReport1.Layout.CustomHeight = val1

    c1FlexReport1.Layout.CustomWidth = val2

        'Set printer name
        options.PrinterSettings.PrinterName = "Printer Name"
    
        c1FlexReport1.Print(options)
    
    
    A sample using the same is attached for your reference. 
    
    Please note, the report gets printed to its paper size only when the same paper size is supported by the printer as well.
    For example, you have set the paper size of your report to A5. But, your printer does not support this A5 paper size. When you will try to print this report using the same printer, it will be printed to the default paper size (say, A4) of your printer.
     
    Kindly share the details of the case you are referring to, in case your issue was not resolved there. 
    
    Also, thanks Wolfgang. 
    
    Best Regards,
    Esha [zip filename="C1FlexReport_PrintOptions.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-a35260a3-58a4-4730-bd25-99ac5835bc3c.zip[/zip]
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels