C1FlexViewer - set printer and printer settings

Posted by: wilmot3 on 27 September 2017, 12:07 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 12:07 pm EST

    WinForms (flexViewer - v4.0.30319, FlexReport - 4.0.20163.212).

    I can not find how to preset the printer and printer settings when viewing a flexreport in the C1.Win.FlexViewer.C1FlexViewer. At the moment when loading up it defaults to the default printer and its settings. I need to (in code) specify which printer and settings depending on the report being viewed.

    We have this working on our C1 reports (C1PrintPreviewControl), passing in the Printer & Page Settings.

    Thanks

    Connor

  • Posted 27 September 2017, 12:07 pm EST

    Hi,

    Please try with the PageSettings of C1FlexViewer as:

    [csharp]c1FlexReport1.Load(“…\…\Report.flxr”, “ProjectType Report”);

    c1FlexViewer1.DocumentSource = c1FlexReport1;

    PageSettings page = c1FlexViewer1.PageSettings;

    PrinterSettings ps = page.PrinterSettings;

    ps.PrinterName = “Microsoft Print to PDF”;[/csharp]

    Hope, it will help you.

    Thanks,

    Sonu

  • Posted 27 September 2017, 12:07 pm EST

    Thanks Sonu,

    I’ll give it a go and let you know :slight_smile:

    Thanks

    Connor

  • Posted 29 July 2019, 3:32 pm EST

    Dear Sir,

    1. How to set reverse option for half of A4 Sized printing… ?

      2.How to print without preview ?

    Regards-

    Sanjeeb

  • Posted 29 July 2019, 7:50 pm EST

    Hello Sanjeeb,

    Answering in the order of the questions asked:

    1. Please elaborate on what you refer to as “reverse option for half of A4 Sized printing”.

      Screenshots of the expected output would be helpful for me to assist you with the same.

    2. You can print a report without previewing it by not using the C1FlexViewer for preview purpose. This can be done, say on a button click using the C1FlexReport.Print method, as follows:

    private void button1_Click(object sender, EventArgs e)
           {
               c1FlexReport1.Render();  
               C1PrintOptions options = new C1PrintOptions();
               options.PrinterSettings = new PrinterSettings();
               options.PageSettings = new PageSettings();
               //setting PrinterName
               options.PrinterSettings.PrinterName = "Microsoft Print to PDF";
       	
          //print directly via Print method	
               c1FlexReport1.Print(options);
           }
    

    You can refer to the various overloads of the Print method from this documentation link:

    An application showing the same is attached for your reference.

    Regards,

    Esha

    prj_FlexReport_Printing.zip

  • Posted 6 August 2019, 3:23 am EST

    Dear Mam,

    I actually want to print 6 Nos of bills on a single a4-portrait sized paper.

    but what’s happening is top-position is not being properly set so that other pages should start from the same top-position.

    some part is being cut to first of second, second of third etc…

    pagebreak is also not working…

    kindly help me mam…

    how to make every pages starting form exact same top-position for proper bill prints ?

    regards-

    Sanjeeb

  • Posted 9 August 2019, 1:50 pm EST

    nobody to help me … ?

    i am also unable to set heading according to page-no parameter ?

    like if page==1,“tax invoice”,“invoice” and so on…

    regards-

    sanjeeb

  • Posted 11 August 2019, 8:21 pm EST

    Hello Sanjeeb,

    Sorry for the delay.

    1 : To make every pages starting form exact same top-position for proper bill prints, you need to set the ForcePageProperty of Detail section to After.

    2 : To set the heading according to the page-no parameter, you need to set the VBScript in the OnPage property of FlexReport which is executed when new page is created.

    I am attaching a demo report which demonstrates the above points, please have a look.

    Thanks and Regards,

    Prabhat Sharma.

    Demo (2).zip

  • Posted 14 August 2019, 2:41 am EST

    Dear Prabhat Sir,

    I don’t know designing the report. I do everything via c# code only.

    thus, kindly request you to provide only code based project for my support so that I can understand.

    Regarding you mentioned to use ForcePageProperty of Detail section to After for proper top positioning on every page.

    I have already tried and also mentioned this as not working for me to break a page any time.

    Sir, Can I also get Filtered Datasource out of C1FlexGrid ?

    Regards-

    Sanjeeb

  • Posted 18 August 2019, 10:08 pm EST

    Hello,

    I am attaching a sample which implements both of your requirement in a code based project via c#.

    ForcePageBreak for Detail section is working fine as my end in the attached sample.

    For your second requirement, you need to use the StartPage event of FlexReport and set the Heading according to page number.

    Please go through the attached sample demonstrating the same.

    Your query regarding FlexGrid is already replied on : https://www.grapecity.com/forums/winforms-edition/flexgrid-start-editing-in-

    Thanks and Regards,

    Prabhat Sharma.

    DemoReport1.zip

  • Posted 5 September 2019, 1:30 pm EST

    Dear Prabhat Sir,

    please find my attachment below with dummy data around 50000 repeated bills but in actual all rows are different to each other to generate 4 bills in a single a4 paper.

    it’s working if less data i.e. 50,100 … repeats/objects/bills is only taken.

    1. how to optimize for performance ?

    2. how to generate multi bills per page with same header and footer with details different and page number different ?

    3. And most important in this way header and footer to manage equal for every pages very difficult.

    4. Code is very misleading i.e. can not be maintained easily. Can we not

      achieve output providing FlexReport.DataSource.Recordset =bills ?

    Thus, kindly suggest the best way to do so…

    regards

    Sanjeeb

    MultiBillsOnSinglePage.zip

  • Posted 5 September 2019, 11:47 pm EST

    Hello,

    Sorry but as per my understanding it is not directly possible to achieve the desired result. You need to use subreports with parameters to achieve this task.

    You can refer the product sample “FlexCommonTasks” for reference at location \Documents\ComponentOne Samples\WinForms\v4\C1FlexReport\CS\FlexCommonTasks and open Side-by-side subreports after running the application.

    Regards,

    Prabhat Sharma.

  • Posted 8 September 2019, 4:19 pm EST

    Hello,

    We are looking into 1st and 4th points.

    We will get back to you once it is done.

    Regards,

    Prabhat Sharma.

  • Posted 9 September 2019, 2:37 am EST

    Respected Prabhat Sir,

    Waiting for your kind support to accomplish this task as well …

    Regards-

    Sanjeeb

  • Posted 10 September 2019, 5:51 pm EST

    Hello Sanjeeb,

    As you are adding multiple fields (27 fields) in header section 50,000 times, resulting in 1350000 fields in the report, the task becomes extremely slow and throws out of memory exception.

    You can simply create fields as per your records in the Detail section and set the Expression property of the fields as per the name of fields in your object and assign the list of object to the DataSource.Recordset property of FlexReport.​

    The TextFields are created as follows:

    ```

    TextField textField = new TextField();

    textField.Name = “FldID”;

    textField.Text.Expression = “Title”;

    textField.Left = 0;

    textField.Top = 0;

    textField.Width = 400;

    textField.Height = 300;

    c1FlexReport1.Sections.Detail.Fields.Add(textField);

     
    Note that the field is added to Detail section (because that is where we add bound fields that take values from the rows in the DataSource). Here, the Text.Expression property is set, based on the name of the field in the list object.
    The DataSource is set as follows:
    

    c1FlexReport1.DataSource.Recordset = pi;

    where "pi" is the list object. 
    
    This way, you would not have to use loops to set values in fields. This will considerably improve the performance of your application.
    Refer the attached application with 2,00,000 records, showing the above implementation.
    This will help you modify your application accordingly.  
    
    Regards,
    Prabhat Sharma.
    [zip filename="demo1.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-805fbdb3-8ea0-4733-a564-37cbdd881c37.zip[/zip]
  • Posted 11 September 2019, 8:00 am EST

    Dear Prabhat Sir,

    This is not the solution I expected…

    The description you provided we have already implemented for general reportings and that’s ok as well.

    This is the case of 4 bills on a single-A4-Paper which is not being managed as per our need.

    Kindly suggest the solution against the above attached project and image…

    Regards-

    Sanjeeb

  • Posted 16 September 2019, 5:23 pm EST

    Hello Sanjeeb,

    Did you refer the “Side-by-side Subreports” report at the “\Documents\ComponentOne Samples\WinForms\v4\C1FlexReport\CS\FlexCommonTasks” location, mentioned earlier?

    Note that it has a subreport rendered side by side in FlexReport. This is done using parameters and multiple data sources specifying values to these parameters. However, the layout here is specific to this report.

    As mentioned ealier, your requirement of printing 4 pages on a sheet cannot be directly achieved. On further investigation, it is observed that using the “Side-by-side subreports” method, you might be able to generate parts of your reports on a same page but it does not assure you of the exact layout of the original page such that 4 intact pages are rendered over a single page.

    Thus, no suitable method exists to meet the exact requirement.

    Apologies for the inconvenience caused.

    Regards,

    Esha

    Note: To get your queries noticed and addressed in time, create a new thread over the forums.

Need extra support?

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

Learn More

Forum Channels