在表单插件中重写BeforeEntityExport
可参考以下示例
public override void BeforeEntityExport(BeforeEntityExportArgs e)
{
base.BeforeEntityExport(e);
e.Headers = new Dictionary<string, List<ExcelField>>();
var headers = new List<ExcelField>();
e.Headers["FEntity"] = headers;
var fieldAppearances = this.View.LayoutInfo.GetFieldAppearances();
foreach (var fieldKey in fieldKeys)
{
var field = this.View.BillBusinessInfo.GetField(fieldKey);
var type = field.GetType();
var excelField = new ExcelField
{
FieldKey = field.Key,
FieldName = field.PropertyName,
Caption = field.Name.ToString(),
ColumnType = field.GetPropertyType(),
Width = 100,
Align = type == typeof(DecimalField) || type == typeof(IntegerField) || type == typeof(AmountField) ? 1 : 0,
};
headers.Add(excelField);
}
}
推荐阅读