A5 Print Problem

Posted by: sanjeeb.srjm on 5 November 2021, 6:43 am EST

  • Posted 5 November 2021, 6:43 am EST - Updated 3 October 2022, 10:49 pm EST

    Dear Sir,

    Please have a look on below images of A5 Print:-

    1. one-A5-print is ok which is printed through FlexViewer.Print();

      but the problem is it’s always asking to select printer which we don’t want…

    2. other-A5-print is zoomed when printed through

      C1PrintOptions result = new C1PrintOptions();

      result.PrinterSettings = new PrinterSettings();

      result.PrinterSettings.PrinterName = App.BillPrinter.RedirectedName();

       either by FlexViewer.DocumentSource.Print(result);
               or by FlexReport.Print(result);
      

    please help us why it’s zooming for A5-Size printing when options provided ?

    Regards-

    Sanjeeb

  • Posted 8 November 2021, 5:49 am EST

    Hi Sanjeeb,

    If you do not want to show the printer dialog then you need to use the Print method of the FlexReport and not the FlexViewer.

    As you mentioned, FlexViewer’s print method is printing fine at your end, it uses the DefaultPrintOptions of the report. You can try using the Default print options and see if the issue persists.

     C1PrintOptions printOps = report.DefaultPrintOptions;
                PrinterSettings printerSettings = new PrinterSettings();
                printerSettings.PrinterName = printerName;
                printerSettings.Copies = 1;
                printerSettings.PrintRange = PrintRange.AllPages;
                printOps.PrinterSettings = printerSettings;
                report.Print(printOps);
    

    If you still face the issue then please share a sample replicating the issue, so that we can investigate this further at our end.

    Regards

    Avnish

  • Posted 8 November 2021, 9:19 am EST

    Dear Sir,

    now direct printing through flxreport is done

    but A5-print is still zoomed-in

    which is ok when printed through flxviewer.print()

    as shown in above pictures …

    Regards-

    Sanjeeb

  • Posted 9 November 2021, 1:10 am EST

    Hi Sanjeeb,

    Could you please share the report with some dummy data so that we can investigate the issue at our end? Also, let us know the steps you follow when printing using the FlexViewer.

    Regards

    Avnish

  • Posted 11 November 2021, 2:33 am EST

    Dear Avnish Sir,

    Please find the below attached sample project which has following problems:-

    There are three forms for A5, A6 & A4-MultiA6-Print formats.

    1. We want to page break for every bill record format which is not being done.
    2. and zooming problem for A5 and A6 Sizes as mentioned above.

    Kindly suggest the solution…

    Regards-

    Sanjeeb

    A5_A6_N_MultiPage.zip

  • Posted 11 November 2021, 6:25 am EST - Updated 3 October 2022, 10:49 pm EST

    Hi Sanjeeb,

    1. You need to create a Report with PageHeader, Detail, and PageFooter section and then you can set the RecordsPerPage property of the report to 1 to print one page for each record. Please refer to the image attached.

    2. The report printed fine at our end. Please make sure your printer supports the PageSize you are using and let us know what printer and with settings you are printing the report. As you mentioned, it prints fine with FlexViewer. Could you please let us know what steps you follow?

    Regards

    Avnish

  • Posted 11 November 2021, 8:52 am EST - Updated 3 October 2022, 10:49 pm EST

    Dear Sir,

    It’s still printing next page in previous page as follows:-

    kindly find my sample attached project and suggest the solution.

    Regards-

    Sanjeeb

    A5_A6_N_MultiPage.zip

  • Posted 12 November 2021, 9:22 pm EST

    Dear Sir,

    Waiting for your kind response…

    Please help us.

    Regards-

    Sanjeeb

  • Posted 14 November 2021, 8:30 pm EST

    Dear Sir,

    Still waiting for support.

    Could you please advise how long will it take to be replied ?

    Regards-

    Sanjeeb

  • Posted 14 November 2021, 11:59 pm EST

    Hi Sanjeeb,

    Sorry for the delay over the weekend.

    We check the sample you sent, you are still creating fields for each record.

    You can create a report with the layout you want and then assign the datasource for the report. Detail section will be repeated for each record.

    If you want to continue your approach then you can just set the ForecePageBreak property of the last field for a record to ForcePageBreakEnum.After. It will create a page break after that field. Please refer to the modified project attached.

    Regards

    Avnish

    DemoReport1_mod.zip

  • Posted 15 November 2021, 5:44 am EST

    Dear Avnish Sir,

    Please find the modified sample project which has only 12-bills but printing 60-pages.

    I know you suggested to do through datasource approach for avoiding repeated field creation for performance and clean code architecture.

    But I am not understanding how to do so in this scenario with bills as datasource.

    Request you to modify the attached project as you suggested.

    Regards-

    Sanjeeb

    A5PrintProblem.zip

  • Posted 15 November 2021, 10:59 pm EST

    Hi Sanjeeb,

    There are 5 distinct months in your data and you have used a loop that runs for the number of distinct months. So the creation of bills occurred 5 times, hence the 60 bills instead of 12. Please refer to the modified sample attached where we removed the loop.

    Regards

    Avnish

    DemoReport1_mod.zip

  • Posted 16 November 2021, 7:42 am EST

    Dear Avnish Sir,

    My mistake of making loop wrong.

    But you still left loop approach in attached project as we had expected to make it datasource approach for huge number of pages like 50,000 at time. which will make it very slow.

    thus kindly advise the datasource approach in this scenario.

    Regards-

    Sanjeeb

  • Posted 17 November 2021, 3:17 am EST

    Hi,

    Please refer to the report attached. You can use the report as a reference and create reports according to your requirements.

    We suggest you refer to the documentation for the information on how to use FlexReport: https://www.grapecity.com/componentone/docs/win/online-flexreport/overview.html

    If you have any specific issues, please let us know.

    Regards

    Avnish

    DemoReport_datasource.zip

  • Posted 19 November 2021, 1:52 am EST - Updated 3 October 2022, 10:50 pm EST

    Dear Avnish Sir,

    got your point of datasource approach and implemented it successfully as well in the attached project.

    but there are formatting issues for any field…

    1. how to format amount and qty as single decimal and double decimal point ?

    2. how to format date in ‘dd-MM-yyyy’ format ?

    3. we want to format data through our own c# custom function. how to do so ?

    4. lastly…

      direct A4-printing through flxreport is ok.

    but A5-print is still zoomed-in

    which is ok when printed through flxviewer.print()

    as shown in below pictures …

    kindly request you to modify attached project as you advise.

    Regards-

    Sanjeeb

    A5PrintProblem.zip

  • Posted 20 November 2021, 9:48 am EST

    Dear Sir,

    Still waiting for support.

    please respond …

    Regards-

    Sanjeeb

  • Posted 24 November 2021, 5:38 am EST

    Hi Sanjeeb,

    Sorry for the delay, I was on leave.

    1 & 2) You can change the format using the Format property of the TextField. For example, you can use the “N1” to display one digit after the decimal.

    field.Format = "N2";
    
    1. You can set the text after formatting to a TextField but if you want to format a calculated field then you should use the Format property. If you have a specific use case then please let us know.

    2. We have escalated the issue to the dev team and will let you know when we have an update. [Internal tracking ID : C1WIN-26174]

    Regards

    Avnish

  • Posted 1 December 2021, 5:13 am EST

    Hi Sanjeeb,

    As per the dev team, you need to define the paper size as shown in the following code when printing using FlexReport’s print method.

    C1PrintOptions result = new C1PrintOptions();
                result.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
                foreach (PaperSize ps in result.PrinterSettings.PaperSizes)
                    if (ps.PaperName == "A5")
                        result.PrinterSettings.DefaultPageSettings.PaperSize = ps;
                FlexReport.Print(result);
    

    Regards

    Avnish

  • Posted 2 December 2021, 5:18 am EST

    Dear Avnish Sir,

    Thankx a lot It worked for A5.

    But we are not getting C1PrintOptions available

    for A6-Paper Size which is just half of A5 …

    below code is not working

    foreach (PaperSize ps in result.PrinterSettings.PaperSizes)

    if (ps.PaperName == “A6”)

    result.PrinterSettings.DefaultPageSettings.PaperSize = ps;

    How could we print for A6-Sizes ?

    Kindly suggest…

    Regards-

    Sanjeeb

  • Posted 2 December 2021, 6:28 am EST

    Hi Sanjeeb,

    The PrinterSettings.PaperSizes property returns the paper sizes supported by the printer. You can set the PrinterSettings.PrinterName property before the paper size and then if your printer supports A6 size then you should not have any issues.

    Sample Code:

    C1PrintOptions result = new C1PrintOptions();
                result.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
                result.PrinterSettings.PrinterName = "Konica_GF";
                foreach (PaperSize ps in result.PrinterSettings.PaperSizes)
                    if (ps.PaperName == "A6")
                        result.PrinterSettings.DefaultPageSettings.PaperSize = ps;
                result.PrinterSettings.PrintRange = PrintRange.CurrentPage;
                FlexReport.Print(result);
    

    Regards

    Avnish

  • Posted 6 December 2021, 5:01 am EST

    Dear Avnish Sir,

    field.Format = “N2” is doing formatting to two decimal.

    we have a function which returns indian lac-crore style comma seperated string

    and according to this function we want to format this field.

    we don’t want to use windows controlled language regions and formatting. instead we would like to format according to our own functions.

    actually we want to call user defined functions to format many things not only number but also dates, Miti, money etc…

    for example:-

    5,24,40,05,250.50

    how to do so ?

    Regards-

    Sanjeeb

  • Posted 8 December 2021, 2:08 am EST

    Hi Sanjeeb,

    The textField.Format property is used to set format for a TextField in the report. Also you can write user defined functions in Report.GlobalScripts and then call them in section.OnFormat script for the required format.

    I have shared a sample report for your reference. Formatted_Text_in_Report.zip

    Let us know if you need any other information.

    Regards,

  • Posted 8 December 2021, 3:24 am EST

    Hi Sanjeeb,

    You can achieve most of your formatting needs using the Format property of TextField in the report. Also, you can write user-defined VBScript functions in Report.GlobalScripts and then call them in section.OnFormat script for the required format.

    We have attached a sample report for your reference.

    Let us know if you need any other information.

    Regards,

    Avnish

    Formatted_Text_in_Report (1).zip

  • Posted 8 December 2021, 6:32 am EST

    Dear Sir,

    both attached samples are designed time flxr file type.

    we can only perform through c# code at runtime.

    kindly suggest how to do the same at runtime by c# code only.

    Regards-

    Sanjeeb

  • Posted 9 December 2021, 5:35 am EST

    Hi,

    Please check the attached C# sample application for reference.

    Hope, it will give you the idea about setting the format in code as well.

    Thanks,

    FlexReportTextFormat.zip

  • Posted 9 December 2021, 11:05 am EST

    Dear Sonu Sir,

    The solution you provided is simply in unbound mode.

    Which we are already doing as per our requirement.

    but it’s not working when in datasource.recordset mode.

    and that’s challenge for us.

    please guide us…

    sir, we also request you to make our blog to sort in descending order by datetime so that every reply will be on top.

    Regards-

    Sanjeeb

  • Posted 10 December 2021, 7:10 am EST

    Hi Sanjeeb,

    Please note, Format is a property of TextField not DataField, it works independent of data source.

    please find a sample application attached for your reference.

    If you are still facing difficulties in a specific use-case kindly let us know.

    If possible, please provide a sample application with dummy data so that we can assist you accordingly.

    Also, sorting is not currently available on the portal. However, we will discuss this requirement with the team here and if found feasible then we will try to implement it in future.

    Regards,

    Sonu Singh

    Formatted_Text_in_Report.zip

  • Posted 11 December 2021, 12:12 am EST

    Dear Sir,

    case 1: Suppose we have following values in a single field/column :-

    420500

    874548254

    487521414785

    110254.52 and so on

    now we want to conditionally format in indian currency style like below:

    4,20,500/- with-yellow bakground because of less than minimum i.e. 5,00,000

    87,45,48,254/- normal

    4,87,52,14,14,785/- with-green bakground because of more than sufficent

    Case 2:

    suppose we have a photo field but datasource has only byte string stored in sqlserver photo field which need to convert everytime on runtime to show as a picture.

    how could we achieve it while passing data as datasource ?

    Regards-

    Sanjeeb

  • Posted 13 December 2021, 6:22 am EST

    Hi Sanjeeb,

    In FlexReport, records are fetch from the DataSource on the time of rendering, so to implement any conditional requirement you would have to define it into the report definition which can only be done using vbScript and not C#.

    Here is a sample based on the above approach. Pictures_in_C1FlexReport.zip

    However, as an alternative you can add the color value of each value in a separate column as string before adding the dataTable to the RecordSet in the following format: “A,R,G,B”.

    I have shared another sample for your reference, Here. Pictures_in_C1FlexReport (1).zip

    Add image from database:

    Please note you can add images in C1FlexReport similar to adding any other value from the database, by using image column name in the ImageField.Picture property. This is also shown in the above samples for your reference.

    To know more on ImageField and Picture property please refer to the following links.

    https://www.grapecity.com/componentone/docs/win/online-flexreport/picture-field.html

    https://www.grapecity.com/componentone/docs/win/online-flexreport//C1.Win.FlexReport.5~C1.Win.FlexReport.ImageField~Picture.html

    Regards,

Need extra support?

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

Learn More

Forum Channels