-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
66 lines (62 loc) · 1.81 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>html2docx test</title>
<style type="text/css">
body {margin: 20px;}
#example-1,.example-2 {padding: 10px;width: 300px;background:#eee;border:1px solid #aaa;}
div{font-size: 18px;font-family: 'Microsoft YaHei'}div p span{color:red}
</style>
</head>
<body>
<h3>Chinese And EN Test (中英文测试)</h3>
<div id="example-1">
<p>this is a test data !</p>
<p>中文测试。哈喽,html2docx.js!</p>
</div>
<button id="example-btn-1">Example1</button><br/>
<h3>Customer Style Test(自定义样式测试)</h3>
<div class="example-2">
<p>Customer Style Test. 我是<span>红色</span>的。</p>
</div>
<button id="example-btn-2">Example2</button><br/>
<h3>测试 margin </h3>
<div class="example-3">
<p>margin: {top: 720}</p>
</div>
<button id="example-btn-3">Example3</button><br/>
<script src="./dist/html2docx.min.js"></script>
<script type="text/javascript">
// Test1
document.getElementById('example-btn-1').addEventListener('click', function(e){
saveAsDocx({
selector: '#example-1'
})
})
// Test2
document.getElementById('example-btn-2').addEventListener('click', function(e){
saveAsDocx({
selector: '.example-2',
styleCss: "<style>div{font-size: 18px;font-family: 'Microsoft YaHei'}div p span{color:red}</style>"
})
})
// Test margin
document.getElementById('example-btn-3').addEventListener('click', function(e){
saveAsDocx({
selector: '.example-3',
styleCss: "<style>div{font-size: 18px;font-family: 'Microsoft YaHei'}div p span{color:red}</style>",
margins: {
top: 720
// right: 120
// left: 320
// bottom: 320
// header: 200
// footer: 200,
// gutter: 700
}
})
})
</script>
</body>
</html>