| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <!DOCTYPE html>
- <html dir="ltr" mozdisallowselectionprint>
- <head>
- <meta charset="utf-8">
- <title>预览word</title>
- <script src="./utils/flexible.js"></script>
- <script src="./utils/ui.js"></script>
- <script src="./word/jszip.min.js"></script>
- <script src="./word/docx-preview.min.js"></script>
- <script src="./utils/getQueryVariable.js"></script>
- <link rel="stylesheet" href="./style/ui.css" />
- </head>
- <style type="text/css">
- * {
- padding: 0;
- margin: 0
- }
- body {
- height: 100vh
- }
- #container {
- width: 100%;
- height: 100%
- }
- .office-docx {
- height: 100%;
- overflow-y: auto
- }
- .office-docx .docx-wrapper>section.docx {
- margin-bottom: 5px
- }
- @media screen and (max-width:800px) {
- .office-docx .docx-wrapper {
- padding: 10px
- }
- .office-docx .docx-wrapper>section.docx {
- padding: 10px !important;
- width: 100% !important
- }
- }
- </style>
- <script>
- function fetchBlobFromUrl(r) {
- return new Promise((e, o) => {
- let n = new XMLHttpRequest;
- n.open("GET", r, !0), n.responseType = "blob", n.onload = function() {
- 200 === n.status ? e(n.response) : o(new Error("Failed to fetch blob: " + n.statusText))
- }, n.onerror = function(e) {
- o(new Error(e))
- }, n.send()
- })
- }(async () => {
- const loading = createLoading();
- loading.show();
- var e = await fetchBlobFromUrl(decodeURIComponent(getQueryVariable("file") || ""));
-
- docx.renderAsync(e, document.getElementById("body"), document.getElementById("container"), {
- className: "office-docx",
- inWrapper: !0,
- ignoreWidth: !0,
- ignoreHeight: !1,
- ignoreFonts: !1,
- breakPages: !0,
- ignoreLastRenderedPageBreak: !0,
- experimental: !1,
- trimXmlDeclaration: !0,
- useBase64URL: !1,
- useMathMLPolyfill: !1,
- showChanges: !1,
- debug: !1
- }).then(e => console.log("docx: finished")).finally(() => {
- loading.hide();
- });
- })()
- </script>
- <body id="body">
- <div id="container"></div>
- </body>
- </html>
|