Skip to content

你好,当前版本(1.31.0)支持内部类的集合操作吗 #516

Closed as duplicate

Description

@LuGuangguang

我按照模板填充的教程自己写的,结果似乎并不支持二级类的访问的集合模板导出,是这样的吗
public class AA
{
public Employee Employee { get; set; }
public Manager Manager { get; set; }
}
public class Employee
{
public string Name { get; set; }
}
public class Manager
{
public string Name { get; set; }
}

static void Main(string[] args)
{
Manager manager = new Manager() { Name = "张三" };
Employee employee = new Employee() { Name = "李四" };

        AA aA = new AA() { Employee = employee, Manager = manager };
        AA aA2 = new AA() { Employee = employee, Manager = manager };
        List<AA> aAs = new List<AA>() { aA, aA2 };
        var value = new
        {
            aAs
        };

        try
        {
            MiniExcel.SaveAsByTemplate("AAA.xlsx", @"模板.xlsx", value);
        }
        catch (Exception ex)
        {
            return;

        }
    }

模板
image

实际结果
image

Activity

  1. tomexou commented on Aug 1, 2023

    @tomexou

    You can use @group...@endgroup keyword in your template files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions