아 답변 감사드립니다.
정신이 없어 이제야 회신 남깁니다.
/**
* 지정된 범위의 셀에 셀 유형을 설정한다.
* @param {Object} spreadObject SpreadJS를 감싸고 있는 Division
* @param {Number} col 적용될 첫 열
* @param {Number} row 적용될 첫 행
* @param {Number} intCellType 셀 유형(CellType Property)
* @param {Number} intAlign 셀 수평 정렬
* @param {Number} maxLen 최대 길이
*/
function setCellType(spreadObject, col, row, intCellType, intAlign, maxLen) {
var obj = spreadObject.Bean;
var activeSheet = obj.getActiveSheet();
var vSpreadJSHAlign = intAlign;
// 기존 ActivcX와 SpreadJS의 값이 다르기 때문에 치환해야 함
// HALIGN_RIGHT : 1 -> 2, HALIGN_CENTER : 2 -> 1
if(intAlign == this.HALIGN_RIGHT)
vSpreadJSHAlign = 2;
else if(intAlign == this.HALIGN_CENTER)
vSpreadJSHAlign = 1;
var vSpreadJSIndex = this.getSpreadJSIndex(spreadObject, row, row, col, col);
var vRow = vSpreadJSIndex.Row;
var vRow2 = vSpreadJSIndex.Row2;
var vCol = vSpreadJSIndex.Col;
var vCol2 = vSpreadJSIndex.Col2;
var cellType = new GC.Spread.Sheets.CellTypes.Text();
var format = "@";
// 버튼 Type
if (intCellType == this.CTYPE_BUTTON) {
cellType = new GC.Spread.Sheets.CellTypes.Button();
// 콤보박스 Type
} else if(intCellType == this.CTYPE_COMBO) {
cellType = new GC.Spread.Sheets.CellTypes.ComboBox();
cellType.editable(false);
// 체크박스 Type
} else if(intCellType == this.CTYPE_CHECK) {
cellType = new GC.Spread.Sheets.CellTypes.CheckBox();
// 날짜 Type
} else if(intCellType == this.CTYPE_DATE) {
format = "yyyy-MM-dd";
// Number Type
} else if(intCellType == this.CTYPE_NUMBER) {
format = "#,##0";
// 시간 Type
} else if(intCellType == this.CTYPE_TIME) {
format = "yyyy-MM-dd hh:mm:ss";
// 백분율
} else if(intCellType == this.CTYPE_PERCENT) {
cellType = new PercentageCellType();
format = "#0.00%";
}
var dv = null;
// Number Type일 경우 최대값, 최소값에 대한 범위 검증을 한다.
if(intCellType == this.CTYPE_NUMBER) {
if(maxLen == null || maxLen < 1){
maxLen = this.NUMBER_MAX;
}
dv = GC.Spread.Sheets.DataValidation.createNumberValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.Between, this.NUMBER_MIN, maxLen, false);
dv.errorMessage("The value entered exceeded the allowed range.");
dv.showErrorMessage(true);
} else if(intCellType == this.CTYPE_EDIT || intCellType == this.CTYPE_STATIC_TEXT) {
if(maxLen == null || maxLen < 1){
maxLen = this.EDIT_MAX_NEN;
}
dv = GC.Spread.Sheets.DataValidation.createTextLengthValidator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.LessThanOrEqualsTo, maxLen);
dv.errorMessage("The number of entered characters exceeds the maximum number of allowed characters.");
dv.showErrorMessage(true);
}
var isReDraw = reDraw(spreadObject);
if(isReDraw)
reDraw(spreadObject, false);
for (var i = vCol; i <= vCol2; i++) {
if(row != -1) {
for (var j = vRow; j <= vRow2; j++) {
/*
if(intCellType == this.CTYPE_STATIC_TEXT)
//this.setCellLock(spreadObject, true, this.getFarPointIndex(i), this.getFarPointIndex(j));
this.setCellLock(spreadObject, this.getFarPointIndex(i), this.getFarPointIndex(j), true);
else if(intCellType == this.CTYPE_COMBO)
this.setCellLock(spreadObject, this.getFarPointIndex(i), this.getFarPointIndex(j), false);
*/
var cell = activeSheet.getCell(j, i);
if(intCellType == this.CTYPE_STATIC_TEXT)
cell.locked(true);
else if(intCellType == this.CTYPE_COMBO)
cell.locked(false);
if(dv != null)
cell.validator(dv);
cell.formatter(format);
cell.hAlign(vSpreadJSHAlign);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
if(cellType != null)
cell.cellType(cellType);
}
} else {
//var column = activeSheet.getColumn(i);
var column = activeSheet.getRange(-1, i, -1, 1);
if(intCellType == this.CTYPE_STATIC_TEXT)
column.locked(true);
else if(intCellType == this.CTYPE_COMBO)
column.locked(false);
if(dv != null)
column.validator(dv);
column.formatter(format);
// Align 지정
column.hAlign(vSpreadJSHAlign);
column.vAlign(GC.Spread.Sheets.VerticalAlign.center);
if(cellType != null)
column.cellType(cellType);
}
}
if(isReDraw)
reDraw(spreadObject, true);
}