vue2利用LoDOP,套打技术原理调试 ●定位 ●表格多数据分页 ●循环表头、表尾 ●表体合计行,同时在富文本编辑器CKEditor中显示预览打印的效果,给出所有具体的代码
时间: 2024-03-27 08:34:49 浏览: 72
vue实现lodop打印功能的示例
由于LoDOP的具体应用场景和套打需求各不相同,因此无法给出具体的代码实现。以下是一些参考代码,供您参考:
1. LoDOP组件初始化
```
mounted () {
const LODOP = getLodop()
if (!LODOP) {
return
}
LODOP.PRINT_INIT('打印控件初始化')
this.LODOP = LODOP
}
```
2. 表格多数据分页
```
this.LODOP.SET_PRINT_STYLE('FontSize', 12)
this.LODOP.SET_PRINT_STYLE('Bold', 1)
this.LODOP.ADD_PRINT_TABLE(20, 20, 400, 200, '表格1')
this.LODOP.ADD_PRINT_TABLE(240, 20, 400, 200, '表格2')
this.LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(1, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(1, 'LinkedItem', '表格1')
this.LODOP.SET_PRINT_STYLEA(1, 'PageGroup', 'newgroup1')
this.LODOP.SET_PRINT_STYLEA(2, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(2, 'LinkedItem', '表格1')
this.LODOP.SET_PRINT_STYLEA(2, 'PageGroup', 'newgroup1')
```
3. 循环表头、表尾
```
this.LODOP.ADD_PRINT_TABLE(20, 20, 400, 200, '表格1')
this.LODOP.ADD_PRINT_TABLE(240, 20, 400, 200, '表格2')
this.LODOP.ADD_PRINT_TABLE(460, 20, 400, 200, '表格3')
this.LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(1, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(2, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(2, 'RepeatHeader', '1')
this.LODOP.SET_PRINT_STYLEA(2, 'RepeatFooter', '1')
```
4. 表体合计行
```
this.LODOP.ADD_PRINT_TABLE(20, 20, 400, 200, '表格1')
this.LODOP.ADD_PRINT_TABLE(240, 20, 400, 200, '表格2')
this.LODOP.ADD_PRINT_TABLE(460, 20, 400, 200, '表格3')
this.LODOP.ADD_PRINT_TABLE(680, 20, 400, 50, '表格4')
this.LODOP.SET_PRINT_STYLEA(0, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(1, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(2, 'ItemType', 1)
this.LODOP.SET_PRINT_STYLEA(3, 'ItemType', 2)
```
5. 在CKEditor中显示预览打印的效果
```
<template>
<div>
<ckeditor
:editor="editor"
v-model="content"
:config="{
extraPlugins: 'autogrow',
autoGrow_minHeight: 200,
autoGrow_onStartup: true,
removePlugins: 'resize'
}"
/>
</div>
</template>
<script>
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
export default {
data () {
return {
editor: ClassicEditor,
content: ''
}
},
mounted () {
this.content = '<div>预览打印的效果</div>'
}
}
</script>
```
以上代码仅供参考,具体实现需要根据实际需求进行调整。
阅读全文