|
@@ -8,9 +8,10 @@ let ColSettingObj = {
|
|
|
DEFAULT_DATA_STYLE: null,
|
|
|
cellType: {
|
|
|
getText: null,
|
|
|
- readOnly: null
|
|
|
+ readOnly: null,
|
|
|
+ checkBox: null
|
|
|
},
|
|
|
- Rows: {data: 0, filedName: 0, getText: 1, width: 2, readOnly: 3},
|
|
|
+ Rows: {data: 0, filedName: 0, getText: 1, wordWrap: 2, width: 3, readOnly: 4, showHint: 5},
|
|
|
columnValueChanged: function (e, info) {
|
|
|
let that = ColSettingObj;
|
|
|
info.colList.forEach(function (iCol) {
|
|
@@ -50,25 +51,31 @@ let ColSettingObj = {
|
|
|
|
|
|
this.cellType.getText = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
this.cellType.getText.items(['getText.type']);
|
|
|
+
|
|
|
+ this.cellType.checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
},
|
|
|
initSheet: function (sheet, setting) {
|
|
|
sheet.setColumnCount(2, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.setColumnWidth(0, 80, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.setColumnWidth(1, 70, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
- sheet.setRowCount(setting.headRows + this.Rows.readOnly + 1);
|
|
|
+ sheet.setRowCount(setting.headRows + this.Rows.showHint + 1);
|
|
|
|
|
|
sheet.setText(setting.headRows + this.Rows.data, 0, 'Data', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.setStyle(setting.headRows + this.Rows.data, -1, this.DEFAULT_DATA_STYLE);
|
|
|
- sheet.addSpan(setting.headRows + this.Rows.data, 0, 2, 1, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
+ sheet.addSpan(setting.headRows + this.Rows.data, 0, this.Rows.wordWrap + 1, 1, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
|
|
|
sheet.setText(setting.headRows + this.Rows.filedName, 1, 'FieldName', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.setText(setting.headRows + this.Rows.getText, 1, 'getText', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
+ sheet.setText(setting.headRows + this.Rows.wordWrap, 1, 'wordWrap', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
|
|
|
sheet.setText(setting.headRows + this.Rows.width, 0, 'width', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.addSpan(setting.headRows + this.Rows.width, 0, 1, 2, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
|
|
|
sheet.setText(setting.headRows + this.Rows.readOnly, 0, 'ReadOnly', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
sheet.addSpan(setting.headRows + this.Rows.readOnly, 0, 1, 2, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
+
|
|
|
+ sheet.setText(setting.headRows + this.Rows.showHint, 0, 'ShowHint', GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
+ sheet.addSpan(setting.headRows + this.Rows.showHint, 0, 1, 2, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
},
|
|
|
initColSetting: function (setting) {
|
|
|
this.DEFAULT_TITLE_STYLE = this.getCellStyle('Arial', GC.Spread.Sheets.HorizontalAlign.center, GC.Spread.Sheets.VerticalAlign.center);
|
|
@@ -124,12 +131,18 @@ let ColSettingObj = {
|
|
|
// getText
|
|
|
cell = sheet.getCell(this.colSetting.headRows + this.Rows.getText, iCol, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
cell.cellType(this.cellType.getText).value(col.data.getText).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
|
|
|
+ // wordWrap
|
|
|
+ cell = sheet.getCell(this.colSetting.headRows + this.Rows.wordWrap, iCol, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
+ cell.cellType(this.cellType.checkBox).value(col.data.wordWrap).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
// 列宽
|
|
|
sheet.setColumnWidth(iCol, col.width);
|
|
|
sheet.setValue(this.colSetting.headRows + this.Rows.width, iCol, sheet.getColumnWidth(iCol), GC.Spread.Sheets.SheetArea.viewport);
|
|
|
// readonly
|
|
|
cell = sheet.getCell(this.colSetting.headRows + this.Rows.readOnly, iCol, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
cell.cellType(this.cellType.readOnly).value(col.readOnly).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
|
|
|
+ // showHint
|
|
|
+ cell = sheet.getCell(this.colSetting.headRows + this.Rows.showHint, iCol, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
+ cell.cellType(this.cellType.checkBox).value(col.showHint).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
}
|
|
|
}
|
|
|
let cell = colEditSpread.getActiveSheet().getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport);
|
|
@@ -141,9 +154,12 @@ let ColSettingObj = {
|
|
|
let sheet = colEditSpread.getActiveSheet();
|
|
|
sheet.setColumnCount(count);
|
|
|
for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {
|
|
|
+ sheet.getCell(this.colSetting.headRows + this.Rows.getText, iCol).cellType(this.cellType.getText).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
|
|
|
+ sheet.getCell(this.colSetting.headRows + this.Rows.wordWrap, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
sheet.setValue(this.colSetting.headRows + this.Rows.width, iCol, sheet.getColumnWidth(iCol), GC.Spread.Sheets.SheetArea.viewport);
|
|
|
- sheet.getCell(this.colSetting.headRows + this.Rows.readOnly, iCol, GC.Spread.Sheets.SheetArea.viewport).cellType(this.cellType.readOnly);
|
|
|
+ sheet.getCell(this.colSetting.headRows + this.Rows.readOnly, iCol).cellType(this.cellType.readOnly).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
|
|
|
sheet.setValue(this.colSetting.headRows + this.Rows.readOnly, iCol, false, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
+ sheet.getCell(this.colSetting.headRows + this.Rows.showHint, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
|
|
|
}
|
|
|
},
|
|
|
setHeaderRowCount: function (count) {
|
|
@@ -199,6 +215,9 @@ let ColSettingObj = {
|
|
|
let col = {};
|
|
|
col.width = sheet.getColumnWidth(iCol);
|
|
|
col.readOnly = sheet.getValue(setting.headRows + this.Rows.readOnly, iCol) || false;
|
|
|
+ if (sheet.getValue(setting.headRows + this.Rows.showHint, iCol)) {
|
|
|
+ col.showHint = sheet.getValue(setting.headRows + this.Rows.showHint, iCol) || false;
|
|
|
+ }
|
|
|
|
|
|
col.head = {};
|
|
|
col.head.titleNames = [];
|
|
@@ -240,6 +259,8 @@ let ColSettingObj = {
|
|
|
col.data.getText = cell.text();
|
|
|
}
|
|
|
setting.cols.push(col);
|
|
|
+ // wordWrap
|
|
|
+ col.data.wordWrap = sheet.getValue(setting.headRows + this.Rows.wordWrap, iCol) || false;
|
|
|
}
|
|
|
return setting;
|
|
|
}
|