-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsambotha.html
36 lines (33 loc) · 948 Bytes
/
sambotha.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
<html>
<head>
<meta charset="utf8">
</head>
<script src="jszip.min.js"></script>
<script src="sambotha.js"></script>
<script>
var r = new FileReader();
function act() {
var file = fileInput.files[0]
r.onload = function() {
var data = r.result
var z = new JSZip(data);
var xml = z.file("word/document.xml").asText()
var doc = docxToJson(xml)
toUnicode(doc)
data = jsonToHtml(doc)
output.innerHTML = data
data = '<meta charset=utf-8>\n' + data
var b = new Blob([data], { encoding:'utf-8',type:'text/html' });
var url = URL.createObjectURL(b);
downLink.href = url
downLink.target = '_blank'
downLink.innerHTML = 'Download'
downLink.download = "convertedDocument.txt"
}
r.readAsBinaryString(file);
}
</script>
<h1>Sambotha to unicode converter</h1>
<input type="file" id="fileInput" onchange=act() accept='.docx'>
<a id=downLink></a>
<hr><div style="font-size:18pt;font-family:Microsoft Himalaya;" id=output></div>