...
|
...
|
@@ -419,7 +419,7 @@ func (d *DataLayoutDataTable) BlockData(cells *domain.LayoutCell) ([]string, int |
|
|
return values, len(values)
|
|
|
}
|
|
|
|
|
|
func (d *DataLayoutDataTable) Shrink() {
|
|
|
func (d *DataLayoutDataTable) Shrink() error {
|
|
|
x := d.PointEnd.X - d.PointBegin.X
|
|
|
y := d.PointEnd.Y - d.PointBegin.Y
|
|
|
data := make([][]string, x+1)
|
...
|
...
|
@@ -435,14 +435,34 @@ func (d *DataLayoutDataTable) Shrink() { |
|
|
}
|
|
|
iData++
|
|
|
}
|
|
|
d.DataTable.Data = data
|
|
|
for i := 0; i <= y; i++ {
|
|
|
//d.DataTable.Data = data
|
|
|
//for i := 0; i <= y; i++ {
|
|
|
// d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
// Name: fmt.Sprintf("列%d", i),
|
|
|
// SQLName: fmt.Sprintf("col%d", i),
|
|
|
// SQLType: domain.String.ToString(),
|
|
|
// })
|
|
|
//}
|
|
|
// 默认计算集第一行作为标题
|
|
|
if len(data) > 1 {
|
|
|
d.DataTable.Data = data[1:]
|
|
|
columnMap := collection.NewSet()
|
|
|
for i := 0; i < len(data[0]); i++ {
|
|
|
if len(data[0][i]) == 0 {
|
|
|
return fmt.Errorf("计算集标题不能为空")
|
|
|
}
|
|
|
if columnMap.Contains(data[0][i]) {
|
|
|
return fmt.Errorf("计算集列重复:%v", data[0][i])
|
|
|
}
|
|
|
columnMap.Add(data[0][i])
|
|
|
d.DataTable.Fields = append(d.DataTable.Fields, &domain.Field{
|
|
|
Name: fmt.Sprintf("列%d", i),
|
|
|
Name: data[0][i],
|
|
|
SQLName: fmt.Sprintf("col%d", i),
|
|
|
SQLType: domain.String.ToString(),
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (d *DataLayoutDataTable) Expand(cell *domain.LayoutCell, length int) error {
|
...
|
...
|
|