home *** CD-ROM | disk | FTP | other *** search
- <MACRO name="On_Document_Open_Complete" lang="JScript"><![CDATA[
-
- function Do_On_Document_Open_Complete() {
- // Include any included text
- var rng = ActiveDocument.Range;
- var magicClass = "SQ-IncludedText";
- var i, j;
-
- // Look for SPAN tag marked for included text
- var nodeList = ActiveDocument.getElementsByTagName("SPAN");
- for (i = 0; i < nodeList.length; i++) {
- var node = nodeList.item(i);
- if (node.getAttribute("CLASS") == magicClass) {
-
- // Look for a LINK with a matching ID
- var idLink = "LINK_" + node.getAttribute("ID");
- var linkList = ActiveDocument.getElementsByTagName("LINK");
- for (j = 0; j < linkList.length; j++) {
- var linkNode = linkList.item(j);
- if (linkNode.getAttribute("ID") == idLink) {
-
- // Get the path to the file with the included text
- var fileURL = linkNode.getAttribute("HREF");
- var filePath = Application.URLToPath(fileURL, ActiveDocument.Path + "\\");
-
- // Replace the contents of SPAN with the included text
- rng.SelectBeforeNode(node);
- rng.MoveToElement("SPAN");
- rng.SelectContainerContents();
- var str = Application.FileToString(filePath);
- rng.TypeText(str);
- }
- }
- }
- }
- }
-
- var viewWYSIWYG = 0;
- var viewTagsOn = 1;
- var viewSource = 2;
- if (ActiveDocument.ViewType == viewWYSIWYG || ActiveDocument.ViewType == viewTagsOn) {
- Do_On_Document_Open_Complete();
- }
- ]]></MACRO>
-