Aspose LINQ Reporting Engine to Conditionally Fill Tables with Collection Items in C#

Hello, @awais.hafeez

Dynamically Show & Fill a Single or Multiple Tables depending on Condition or Collection Items | C# LINQ Reporting

I am trying to do the same above thing, but examples ZIP file blocked by error message “Sorry, this file is private. Only visible to topic owner and staff members.” Could you please post the solution here in the thread, that it is accessible for everybody?
Thank you!

@vova.k,

Please check the following C# code of Aspose LINQ Reporting Engine and attached template and output Word DOCX documents:

public class Person
{
    public string Name { get; set; }
    public List<Person> Children { get; set; }
}

private static List<Person> GetPersons()
{
    return new List<Person>
        {
            new Person
            {
                Name = "Jane Doe",
                Children = new List<Person>
                {
                    new Person { Name = "Ann Doe" },
                    new Person { Name = "John Doe" }
                }
            },
            new Person
            {
                Name = "John Smith",
                Children = new List<Person>
                {
                    new Person { Name = "Tom Smith" }
                }
            }
        };
}

public void DynamicallyShowAndFillTableDependingOnCondition()
{
    Document document = new Document(MyDir + "DynamicallyShowAndFillTableDependingOnCondition.docx");

    ReportingEngine engine = new ReportingEngine();
    engine.Options |= ReportBuildOptions.RemoveEmptyParagraphs;
    engine.BuildReport(document, GetPersons(), "persons");

    document.Save(MyDir + "DynamicallyShowAndFillTableDependingOnCondition Out.docx");
}

public void DynamicallyFillMultipleTablesDependingOnCollectionItems()
{
    Document document = new Document(MyDir + "DynamicallyFillMultipleTablesDependingOnCollectionItems.docx");

    ReportingEngine engine = new ReportingEngine();
    engine.Options |= ReportBuildOptions.RemoveEmptyParagraphs;
    engine.BuildReport(document, GetPersons(), "persons");

    document.Save(MyDir + "DynamicallyFillMultipleTablesDependingOnCollectionItems Out.docx");
}

Thank you @awais.hafeez for the examples.

1 Like

A post was split to a new topic: Aspose LINQ Reporting Engine to Conditionally Fill Tables with Collection Items