|
@@ -1,5 +1,6 @@
|
|
|
import Docxtemplater from 'docxtemplater'
|
|
|
import PizZip from 'pizzip'
|
|
|
+// import HTMLModule from 'docx'
|
|
|
function MakerSpaceWord(data,fund){
|
|
|
//获取模板文件
|
|
|
let _url = "./file/2023年二级学院特色创客空间建设项目申报书模板.docx";
|
|
@@ -9,7 +10,6 @@ function MakerSpaceWord(data,fund){
|
|
|
x.onload = function (e) {
|
|
|
const blob = x.response;
|
|
|
//转成binary
|
|
|
-
|
|
|
const reader = new FileReader();
|
|
|
reader.readAsArrayBuffer(blob);
|
|
|
reader.onload=function(a){
|
|
@@ -71,10 +71,16 @@ function MakerSpaceWord(data,fund){
|
|
|
fundDataArray.push(fundData);
|
|
|
})
|
|
|
|
|
|
+ //去除标签
|
|
|
+ for(let i in data['chapters']){
|
|
|
+ data['chapters'][i]=data['chapters'][i].replace(/<[^>]+>/g,"");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//模板数据
|
|
|
let wordData = {
|
|
|
+ ing:data['typeName']==0?"√":"□", //已建设
|
|
|
+ ed:data['typeName']==0?"□":"√", //待建设
|
|
|
projectName:data['title'],//项目名称
|
|
|
college:data['name'],//
|
|
|
begin_at:data['begin_at'],//项目开始时间
|
|
@@ -108,9 +114,7 @@ function MakerSpaceWord(data,fund){
|
|
|
}
|
|
|
//渲染模板
|
|
|
doc.setData(wordData);
|
|
|
-
|
|
|
doc.render();
|
|
|
- console.log(wordData)
|
|
|
//获取渲染后的文本
|
|
|
const output = doc.getZip().generate({
|
|
|
type: "blob",
|