你好,我是按照如下步骤进行测试的:
- DataTable myTable = new System.Data.DataTable();
- myTable.Columns.Add("col1",typeof(System.Int32));
- myTable.Columns.Add("col2", typeof(System.Int32));
- myTable.Columns.Add("col3", typeof(System.Int32));
- myTable.Columns.Add("col4", typeof(System.Int32));
- myTable.Columns.Add("col5", typeof(System.Int32));
- myTable.Columns.Add("col6", typeof(System.Int32));
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- this.fpSpread1.DataSource = myTable;
复制代码 效果图
png
- DataTable myTable = new System.Data.DataTable();
- myTable.Columns.Add("col1",typeof(System.Double));
- myTable.Columns.Add("col2", typeof(System.Double));
- myTable.Columns.Add("col3", typeof(System.Double));
- myTable.Columns.Add("col4", typeof(System.Double));
- myTable.Columns.Add("col5", typeof(System.Double));
- myTable.Columns.Add("col6", typeof(System.Double));
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- myTable.Rows.Add("1", "1", "1", "1", "1", "1");
- this.fpSpread1.DataSource = myTable;
- FarPoint.Win.Spread.CellType.NumberCellType numberType = new FarPoint.Win.Spread.CellType.NumberCellType();
- numberType.DecimalPlaces = 0;
- this.fpSpread1.ActiveSheet.Columns[0].CellType = numberType;
复制代码 效果图:
png
你也可以根据不同情况进行尝试, 同时,Spread 帮助文档中有大量的例程,对解决一些类似的问题很有帮助,建议参考。 |