<template>
<div class="boxpre">
<div ref="excelView" id="excelView" :style="spreadStyle" style="margin-left: 20px;margin-top: 60px" ></div>
</div>
</template>
<script>
export default {
name: "preview",
data () {
return {
CellData:'',
fileName: "",
//导入导出参数
excelIo: {},
spread: {},
spread1:{},
spreadStyle: {
width: 'calc(100% - 1px)',
height: '700px',
},
font:[],
sheet: {}, //初始化表单数据
autoRow:[],//渲染excel row
show:true
}
},
mounted() {
//初始化表单对象
// var that=this
this.spread = new this.GC.Spread.Sheets.Workbook(document.getElementById("excelView"), {sheetCount: 3});
this.sheet =this.spread.getActiveSheet('Sheet2');
//添加行头列头
var spreadNS = this.GC.Spread.Sheets;
this.sheet.suspendPaint();
//Set rowHeader count and columnHeader count.
this.sheet.setRowCount(2, spreadNS.SheetArea.colHeader);
this.sheet.setColumnCount(2, spreadNS.SheetArea.rowHeader);
console.log(this.sheet.getRowCount())
for (let i=0;i<this.sheet.getRowCount();i++){
let c= new this.GC.Spread.Sheets.CellTypes.CheckBox();
this.sheet.setCellType(i, 0, c, this.GC.Spread.Sheets.SheetArea.rowHeader);
}
for (let j=0;j<this.sheet.getColumnCount();j++){
let d= new this.GC.Spread.Sheets.CellTypes.CheckBox();
this.sheet.setCellType(0, j, d, this.GC.Spread.Sheets.SheetArea.colHeader);
}
//添加excel模块
this.excelIo =new this.excelIO.IO();
//默认打印方式
// this.printOca(this.printOca)
},
methods:{
}
}
</script>
<style scoped lang="less">
</style> 上一个少了几句挂载时得代码 |