Changeset 785 for trunk/docx4j/src/main/javascript
- Timestamp:
- 04/15/09 02:45:21 (3 years ago)
- File:
-
- 1 edited
-
trunk/docx4j/src/main/javascript/wml_fix.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/javascript/wml_fix.js
r782 r785 30 30 //alert(paragraphs.length); 31 31 for (var i=0 ; i<paragraphs.length; i++) { 32 33 // @contentEditable34 paragraphs[i].setAttribute("contentEditable", "true");35 32 36 33 // @class … … 184 181 185 182 186 function mySave(url) {187 var xmlDocument = new DOMParser().parseFromString("<root />", "text/xml");188 xmlDocument.documentElement.appendChild( XPath.selectNodes("//pkg:package", document)[0] );189 // works, but since this is HTML, element names are still capitalised190 //alert(xmlDocument.length);191 if (xmlDocument) {192 var httpRequest = postXML(url, xmlDocument);193 if (httpRequest && httpRequest.status==200) {194 195 //alert('HTTP response status: ' + httpRequest.status);196 197 // Convert to object with data url198 var contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";199 var dataURL = "data:"+contentType + ";base64," + httpRequest.responseText;200 201 // Use iframe, not <object>, since for the latter,202 // Firefox insists on looking for a plugin203 var obj = document.createElement("iframe");204 obj.setAttribute("src", dataURL);205 obj.setAttribute("style", "display:none;");206 //obj.setAttribute("type", contentType);207 var body = document.getElementsByTagName("body")[0];208 body.appendChild(obj);209 210 } else {211 alert("What happened??");212 }213 }214 }215 216 217 /*218 function resolver(prefix){219 switch(prefix){220 case "w" : return "http://schemas.openxmlformats.org/wordprocessingml/2006/main";221 case "pkg": return "http://schemas.microsoft.com/office/2006/xmlPackage";222 case "rel": return "http://schemas.openxmlformats.org/package/2006/relationships"223 case "r" : return "http://schemas.openxmlformats.org/officeDocument/2006/relationships";224 case "a" : return "http://schemas.openxmlformats.org/drawingml/2006/main";225 case "ns6": return "http://schemas.openxmlformats.org/schemaLibrary/2006/main";226 case "pic": return "http://schemas.openxmlformats.org/drawingml/2006/picture";227 case "wp" : return "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";228 default: return null; // or xhtml?229 }230 } */231 183 232 184 function createBlockCss(pPr) { … … 466 418 } 467 419 468 function postXML (url, xmlDocument) {469 try {470 var httpRequest = new XMLHttpRequest();471 httpRequest.open('POST', url, false);472 httpRequest.send(xmlDocument);473 return httpRequest;474 }475 catch (e) {476 output("Can't post XML document");477 return null;478 }479 }480 481 482 483 484 485 486 420 setAttributes();
Note: See TracChangeset
for help on using the changeset viewer.
