?基礎導出模板
const html = `<html><head><style>body {font-family: 'Times New Roman';}h1 {text-align: center;}table {border-collapse: collapse;width: 100%;color: '#1118FF';font-weight: 600;}th,td {border: 1px solid black;padding: 8px;text-align: left;}</style></head><body><div style="font-size: 20px;font-weight: 600;margin-bottom: 20px;margin-left: 15px;">附件:孜然卷測試問題主要問題匯總</div><table><thead><tr><th>科室</th><th>住院號</th><th>問題</th><th>管床醫生</th><th>扣分</th></tr></thead><tbody><tr><th>孜然卷科室test1</th><th>住院號test1</th><th>問題test1</th><th>管床醫生test1</th><th>扣分test1</th></tr></tbody></table></body></html>`;const blob = new Blob([html], {type: 'application/msword',});const link = document.createElement('a');link.download = `2025年2月導出.doc`;link.href = URL.createObjectURL(blob);link.click();
其中如果要加入Echarts圖表,則需在創建Echarts圖表時,將其myChartWord保存

在需要引用圖片時 使用上面保存的myChartWord的getDataURL()函數
<img src=${this.state.myChartWord.getDataURL({ pixelRatio: 2, backgroundColor: '#fff' })}/>