fpSpread1_Sheet1.Columns.Clear();
fpSpread1_Sheet1.ColumnCount = mainGridMetaList.Count();
fpSpread1_Sheet1.AutoGenerateColumns = false;
fpSpread1_Sheet1.RowHeader.Columns.Default.Resizable = false;
fpSpread1_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
var i = 0;
foreach (var columnMeta in mainGridMetaList)
{
//fpSpread1_Sheet1.ColumnHeader.Cells.Get(0, i).Value =columnMeta.field;
fpSpread1_Sheet1.Columns.Get(i).AllowAutoSort = columnMeta.isSort;
fpSpread1_Sheet1.Columns.Get(i).Label = columnMeta.fieldName;
fpSpread1_Sheet1.Columns.Get(i).DataField = columnMeta.field;
fpSpread1_Sheet1.Columns.Get(i).SortIndicator = FarPoint.Win.Spread.Model.SortIndicator.None;
fpSpread1_Sheet1.Columns.Get(i).Visible = columnMeta.isShow;
fpSpread1_Sheet1.Columns.Get(i).Width = columnMeta.width;
if (columnMeta.fieldType == "datetime")
{
var t = new FarPoint.Win.Spread.CellType.DateTimeCellType();
t.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDateWithTime;
fpSpread1_Sheet1.Columns.Get(i).CellType = t;
}
i++;
}
this.fpSpread1_Sheet1.DataSource = data;
|
|