FlexReport change datasource after template is made

Posted by: jacobturley on 12 October 2017, 3:18 am EST

    • Post Options:
    • Link

    Posted 12 October 2017, 3:18 am EST

    Hey all! So I am new and evaluating this, and trying to figure this out. Essentially, we want a “fancy print” of the data that we are displaying in a grid. Is there a way for me, through the gui, able to design the report(i.e. they layout with images etc.) and then just add fields to the detail section dynamically? Sorry I am new. It looks like it is possible, I just don’t know how to EDIT and add fields to an existing template.

  • Posted 12 October 2017, 7:40 pm EST

    Hi,

    Using the Data group on the Home Tab of the C1FlexReportDesigner, you can change the Data Source any time after you have fixed a report’s style/ template. Refer the below documentation link that shows the group in the Design mode.

    http://helpcentral.componentone.com/nethelp/FlexReport/DesignMode.html

    Also, Data Source can be changed at run-time for any report using the below mentioned code snippet:

    
    c1FlexReport1.DataSource.RecordSourceType = RecordSourceType.Auto;
    string dsPath=Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString();
    c1FlexReport1.DataSource.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + dsPath +@"\ComponentOne Samples\Common
    \C1NWind.mdb";
    c1FlexReport1.DataSource.RecordSource = "Employees";
    

    You can add fields like images, charts, shapes, etc in a report using the FlexReportDesigner using the Insert tab. You can learn more about inserting each field from the below documentation link:

    http://helpcentral.componentone.com/nethelp/FlexReport/AddingFlexReportFields.html

    For images, you might want to follow the steps mentioned here:

    http://helpcentral.componentone.com/nethelp/FlexReport/ImageField.html

    Next, you can add fields to the Detail section dynamically using the below code snippet:

    // create the Detail section   
               s = c1FlexReport1.Sections[SectionTypeEnum.Detail];
               s.Height = 330;
               s.Visible = true;
               
               TextField textField = new TextField();
               textField.Name = "FldID";
               textField.Text.Expression = "EmployeeID";
               textField.Left = 0;
               textField.Top = 0;
               textField.Width = 400;
               textField.Height = 300;
               c1FlexReport1.Sections.Detail.Fields.Add(textField);
    
    

    Here, a TextField is inserted.

    Let us know if you wish to display the grid as an image or simply a grid-like layout which can be obtained using the borders of the fields and sections and ShapeFields.

    Hope this helps.

    Regards,

    Esha

Need extra support?

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

Learn More

Forum Channels