public IXLRange ApplyDataCellFormat(IXLRange range, DataCellType type) { //range.Style.Fill.BackgroundColor = XLColor.FromTheme(XLThemeColor.Background1); switch (type) { case DataCellType.Boolean: range.DataType = XLDataType.Boolean; break; case DataCellType.Percentage: range.DataType = XLDataType.Number; range.Style.NumberFormat.NumberFormatId = 9; // 0% break; case DataCellType.Integer: range.DataType = XLDataType.Number; range.Style.NumberFormat.NumberFormatId = 1; // 0 break; case DataCellType.Decimal: range.DataType = XLDataType.Number; range.Style.NumberFormat.Format = "#,##0.######"; break; case DataCellType.Monetary: range.DataType = XLDataType.Number; range.Style.NumberFormat.NumberFormatId = 4; // #,##0.00 break; case DataCellType.Date: range.DataType = XLDataType.DateTime; range.Style.NumberFormat.NumberFormatId = 14; // d/m/yyyy break; case DataCellType.DateTime: range.DataType = XLDataType.DateTime; range.Style.NumberFormat.NumberFormatId = 22; // m/d/yyyy H:mm break; case DataCellType.Label: range.DataType = XLDataType.Text; range.Style.Alignment.WrapText = true; range.Style.NumberFormat.NumberFormatId = 49; // @ break; case DataCellType.Text: range.DataType = XLDataType.Text; range.Style.Alignment.WrapText = true; range.Style.NumberFormat.NumberFormatId = 49; // @ break; } return(range); }
public object ValueFomatted(object source, DataCellType dataFormater) { if (DataSouceType != null && ForzenColumn != null) { List <string> s = new List <string>(); IList DataSourceValue = GetList(DataSouceType) as IList; foreach (DataGridViewRow row in this.Rows) { if (this[ForzenColumn.Index, row.Index].Value != null) { object Entity = System.Activator.CreateInstance(DataSouceType); foreach (DataGridViewColumn column in this.Columns) { string DataPropertyName = column.DataPropertyName; if (!string.IsNullOrEmpty(DataPropertyName)) { PropertyInfo propertyInfo = Entity.GetType().GetProperty(DataPropertyName); if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(int)) { propertyInfo.SetValue(Entity, TryParse.StrToInt(this[column.Index, row.Index].Value), null); } else if (propertyInfo.PropertyType == typeof(decimal)) { propertyInfo.SetValue(Entity, TryParse.StrToDecimal(this[column.Index, row.Index].Value), null); } else { propertyInfo.SetValue(Entity, this[column.Index, row.Index].Value, null); } } } } DataSourceValue.Add(Entity); } else { break; } } return(DataSourceValue); } return(null); }
public DataCell(string content, DataCellType type, DataCellOutline outline = DataCellOutline.None) { this.Content = content; this.Type = type; this.Outline = outline; }
public object ValueFomatted(object source, DataCellType dataFormater) { return(source); }
public string ValueFomatted(string source, DataCellType dataFormater) { return(source); }
internal void Read(Interface30 r, DxfDataTable.Class273 tableBuilder, int columnIndex) { this.dataCellType_0 = (DataCellType)r.imethod_11(); this.string_0 = r.ReadString(); foreach (DxfDataCell dxfDataCell in this.list_0) { switch (this.dataCellType_0) { case DataCellType.Unknown: dxfDataCell.Value = (DxfDataCellValue)DxfDataCellValue.Unknown.Instance; continue; case DataCellType.Int32: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.Int32(r.imethod_11()); continue; case DataCellType.Double: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.Double(r.imethod_8()); continue; case DataCellType.String: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.String(r.ReadString()); continue; case DataCellType.Point3D: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.Point3D(r.imethod_39()); continue; case DataCellType.ObjectId: DxfDataCellValue.ObjectIdBase o1 = (DxfDataCellValue.ObjectIdBase) new DxfDataCellValue.ObjectId(); tableBuilder.Add((Interface10) new DxfDataCellValue.ObjectIdBase.Class554(o1, r.imethod_32(true))); dxfDataCell.Value = (DxfDataCellValue)o1; continue; case DataCellType.HardOwnerId: DxfDataCellValue.OwnerIdBase o2 = (DxfDataCellValue.OwnerIdBase) new DxfDataCellValue.HardOwnerId(); tableBuilder.Add((Interface10) new DxfDataCellValue.OwnerIdBase.Class555(o2, r.imethod_32(true))); dxfDataCell.Value = (DxfDataCellValue)o2; continue; case DataCellType.SoftOwnerId: DxfDataCellValue.OwnerIdBase o3 = (DxfDataCellValue.OwnerIdBase) new DxfDataCellValue.SoftOwnerId(); tableBuilder.Add((Interface10) new DxfDataCellValue.OwnerIdBase.Class555(o3, r.imethod_32(true))); dxfDataCell.Value = (DxfDataCellValue)o3; continue; case DataCellType.HardPointerId: DxfDataCellValue.ObjectIdBase o4 = (DxfDataCellValue.ObjectIdBase) new DxfDataCellValue.HardPointerId(); tableBuilder.Add((Interface10) new DxfDataCellValue.ObjectIdBase.Class554(o4, r.imethod_32(true))); dxfDataCell.Value = (DxfDataCellValue)o4; continue; case DataCellType.SoftPointerId: DxfDataCellValue.ObjectIdBase o5 = (DxfDataCellValue.ObjectIdBase) new DxfDataCellValue.SoftPointerId(); tableBuilder.Add((Interface10) new DxfDataCellValue.ObjectIdBase.Class554(o5, r.imethod_32(true))); dxfDataCell.Value = (DxfDataCellValue)o5; continue; case DataCellType.Bool: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.Bool(r.imethod_6()); continue; case DataCellType.Vector3D: dxfDataCell.Value = (DxfDataCellValue) new DxfDataCellValue.Vector3D(r.imethod_51()); continue; default: throw new Exception("DataCellType " + (object)this.dataCellType_0 + " is not supported."); } } }
public DxfDataColumn(DataCellType cellType, string name) { this.dataCellType_0 = cellType; this.Name = name; }
public DxfDataColumn(DataCellType cellType) { this.dataCellType_0 = cellType; }