C1FlexReport

Posted by: s.wortmann on 27 November 2024, 7:33 am EST

    • Post Options:
    • Link

    Posted 27 November 2024, 7:33 am EST

    Hello,

    I am seeking a straightforward VB example that includes the following:

    Which “ToolBoxItems” need to be placed on the Form to get a C1FlexReport?

    How do I load a File"FlexReport.flxr" containing only “Report1” using VB code?

    How do I populate the fields of Report1?

    It is a single page with various fields, and these fields must be filled via code (without any database, etc.).

    Once the report is displayed, how can I export it to a PDF document using VB code?

    I hope you can assist me with this.

    Best regards, Stephan

  • Posted 28 November 2024, 3:07 am EST

    Hello Stephan,

    1. You can use FlexViewer control to view FlexReports and FlexReport component to load FlexReports.

      After installing WinForms Suite, the C1 controls automatically show up in the toolbox for .NET FrameWork projects. However, you’ll need to install corresponding NuGet packages to use C1 controls in .NET project (C1.Win.FlexReport and C1.Win.FlexViewer)
    2. You can load reports using the Load() method of FlexReport. Please refer to the following for more information: https://developer.mescius.com/componentone/docs/win/online-flexreport/load-reports.html
    3. You can use three different ways to pass values to your fields by code:

      (a) Setting the Text values directly of the field by code.
    DirectCast(C1FlexReport1.Fields("Field2"), TextField).Text = "Value entered by code"

    (b) Passing the parameter in FlexReport. For more info, refer to: https://developer.mescius.com/componentone/docs/win/online-flexreport/UsingParameters.html

    (c) Retrieve Data from DataTable Objects. For more info, refer to: https://developer.mescius.com/componentone/docs/win/online-flexreport/DataBindinginFlexReport.html#i-heading-retrieve-data-from-datatable-objects

    4. You can export your report to pdf using a PdfFilter as follows:

    Dim filter As New C1PdfFilter
    filter.FileName = "test.pdf"
    C1FlexReport1.RenderToFilter(filter)

    For more info, refer to: https://developer.mescius.com/componentone/docs/win/online-flexreport/ExportingReportstoVariousFormats.html#i-heading-export-to-pdf

    Please refer to the attached sample for implementation. (see FlexReportSample.zip)

    Regards,

    Uttkarsh.

  • Posted 2 December 2024, 9:05 am EST - Updated 2 December 2024, 9:10 am EST

    Dear Uttkarsh,

    Thank you for your response.

    I believe I have grasped many of the points you’ve written and linked.

    Further, I require assistance in creating a C1FlexReport using the C1FlexReportDesigner (32-bit mode) to achieve a result similar to the attached picture.

    Maybe you can give me a short help, how to create a Report with one or more Sub-Reports.

  • Posted 3 December 2024, 2:55 am EST

    Hello Stephan,

    Please refer to the attached sample report, which we created using XML DataSource, and let us know if it fulfils your requirement.

    Sample: SampleReport.zip

    Regards,

    Uttkarsh.

  • Posted 3 December 2024, 4:22 am EST - Updated 3 December 2024, 8:39 am EST

    Hello Uttkarsh,

    thank you very much for the example; it was really helpful.

    However, I still have a few questions:

    How do I set the Datasource of each Subreport an the Report to an own DataView / DataTable?

    How does the report(s) know which Report-Field will be filled out of the result DataView/DaTaTable?

    Best regards

    Stephan

  • Posted 4 December 2024, 2:58 am EST

    Hello Stephan,

    You can access the SubReport Field in the FlexReport and set its DataSource.RecordSet property to the DataTable as follows:

    Dim Detail01 = DirectCast(C1FlexReport1.Fields("Field12"), SubreportField).Subreport
    Detail01.DataSource.RecordSourceType = RecordSourceType.TableDirect
    Detail01.DataSource.Recordset = GetData("Data1")

    Please refer to the attached sample for implementation. (see FlexReportSample_Mod.zip)

    How does the report(s) know which Report-Field will be filled out of the result DataView/DaTaTable?

    When a bound field is added to a report, its Text property is automatically set to an expression. This expression starts with an “=” character followed by the name of the DataSource-Property it is bound to. For instance, if a field is linked to a column named CustomerName in a DataTable, the Text property of that field will display something like =CustomerName.

    Regards,

    Uttkarsh.

  • Posted 4 December 2024, 7:10 am EST

    Hello Uttkarsh.

    Thank you very much for your detailed help.

    I am now in the position to use the C1FlexReport and C1FlexViewer in my actual programming.

    Best regards,

    Stephan

Need extra support?

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

Learn More

Forum Channels