|
@@ -61,23 +61,28 @@ var SheetDataHelper = {
|
|
|
}
|
|
|
sheet.setColumnCount(setting.cols.length);
|
|
|
sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- setting.headRowHeight.forEach(function (rowHeight, index) {
|
|
|
- sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- })
|
|
|
- setting.cols.forEach(function (col, index) {
|
|
|
- var i, iRow = 0, cell;
|
|
|
- for (i = 0; i < col.head.spanCols.length; i++) {
|
|
|
- if (col.head.spanCols[i] !== 0) {
|
|
|
- cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
|
|
|
- }
|
|
|
- if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
|
|
|
- sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- }
|
|
|
- iRow += col.head.spanRows[i];
|
|
|
- };
|
|
|
- sheet.setColumnWidth(index, col.width);
|
|
|
- });
|
|
|
+ if (setting.headRowHeight) {
|
|
|
+ setting.headRowHeight.forEach(function (rowHeight, index) {
|
|
|
+ sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (setting.cols) {
|
|
|
+ sheet.setColumnCount(setting.cols.length);
|
|
|
+ setting.cols.forEach(function (col, index) {
|
|
|
+ var i, iRow = 0, cell;
|
|
|
+ for (i = 0; i < col.head.spanCols.length; i++) {
|
|
|
+ if (col.head.spanCols[i] !== 0) {
|
|
|
+ cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
|
|
|
+ }
|
|
|
+ if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
|
|
|
+ sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }
|
|
|
+ iRow += col.head.spanRows[i];
|
|
|
+ };
|
|
|
+ sheet.setColumnWidth(index, col.width);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
protectdSheet: function (sheet) {
|
|
|
var option = {
|