export declare const NSDocxExportCode = "var nsModuleExport = function(root,name,prototype)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\tmodule.exports[name] = prototype;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\tdefine(name,[], function () {return prototype;});\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\texports[name] = prototype;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\troot[name] = prototype;\r\n\t\t}\r\n\t};var nsIsWeb = function(root)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};if(!nsIsWeb())\r\n\t\t{\r\nvar nsutilRef = require('./nsUtil.min.js');\r\nvar NSUtil = nsutilRef.NSUtil;\r\n\r\n\t\t}\r\nvar NSZip = (function()\r\n{\r\n\tvar NSZip = function(config)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar setting = {};\r\n\t    \r\n\t    var objFiles = {};\r\n\t    var util = null;\r\n\t\t\r\n\t\tvar initialize = function()\r\n\t\t{\r\n\t\t\tif(!config)\r\n\t\t\t{\r\n\t\t\t\tconfig = {};\r\n\t\t\t}\r\n\t\t\t/*setting = {\r\n\t\t\t\tfileName: config[\"fileName\"] || \"download\",\r\n\t\t\t\tmimeType: config[\"mimeType\"] || \"application/zip\"\r\n\t\t\t};\r\n\t\t\tif (setting.fileName.indexOf(\".\") === -1) \r\n\t\t\t{\r\n\t\t\t\tsetting.fileName = setting.fileName + \".zip\";\r\n\t        }*/\r\n\t\t\tutil = new ZipUtil();\r\n\t\t};\r\n\t\t\r\n\t\tvar getFile = function(type,mimeType)\r\n\t\t{\r\n\t\t\tvar objRet = null;\r\n\t\t\ttype = type ? type : \"blob\";\r\n\t\t\tswitch(type) \r\n\t\t\t{\r\n\t\t\t\tcase \"blob\":\r\n\t\t\t\t\tobjRet = getBlob(mimeType);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn objRet;\r\n\t\t};\r\n\t\t\r\n\t\tvar addFolders = function(arrPath)\r\n\t\t{\r\n\t\t\tvar arrReturn = null;\r\n\t\t\tif(arrPath && arrPath.length > 0)\r\n\t\t\t{\r\n\t\t\t\tarrReturn = [];\r\n\t\t\t\tfor(var index = 0;index < arrPath.length;index++)\r\n\t\t\t\t{\r\n\t\t\t\t\tarrReturn.push(addFolder(arrPath[index]));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn arrReturn;\r\n\t\t};\r\n\t\t\r\n\t\tvar addFolder = function(path)\r\n\t\t{\r\n\t\t\treturn createFolder(path);\r\n\t\t};\r\n\t\t\r\n\t\tvar addFile = function(path,content,prop)\r\n\t\t{\r\n\t\t\treturn createFile(path,content,prop,false);\r\n\t\t};\r\n\t\t\r\n\t\tvar createFolder = function(path)\r\n\t\t{\r\n\t\t\tpath = util.addSlashAtEnd(path);\r\n\t\t\tif(objFiles[path])\r\n\t\t\t{\r\n\t\t\t\treturn objFiles[path].zipFile;\r\n\t\t\t}\r\n\t\t\treturn createFile(path,null,null,true);\r\n\t\t};\r\n\t\t\r\n\t\tvar createFile = function(path,content,prop,isDir)\r\n\t\t{\r\n\t\t\tprop = prop ? prop : {};\r\n\t\t\tvar item = {path: path,content: content,origContent: content};\r\n\t\t\titem.created = new Date();\r\n\t\t\titem.dataType = util.getDataType(content);\r\n\t\t\titem.isDir = isDir ? true : false;\r\n\t\t\tvar parent = util.getParentFolder(path);\r\n\t\t\tif(parent)\r\n\t\t\t{\r\n\t\t\t\tcreateFolder(parent);\r\n\t\t\t}\r\n\t\t\titem.isBase64 = (item.type == \"base64\");\r\n\t\t\titem.isBinary = (item.type == \"binary\");\r\n\t\t\tvar isUnicodeString = (item.dataType === \"string\") && item.isBase64 && item.isBinary;\r\n\t\t\tif (item.type != \"binary\") \r\n\t\t\t{\r\n\t\t\t\titem.isBinary = !isUnicodeString;\r\n\t\t    }\r\n\t\t\tif(item.isDir || !path || !path.length)\r\n\t\t\t{\r\n\t\t\t\titem.dataType = \"string\";\r\n\t\t\t\titem.isBase64 = false;\r\n\t\t\t\titem.isBinary = true;\r\n\t\t\t\titem.content = \"\";\r\n\t\t\t}\r\n\t\t\titem.content = getContent(item);\r\n\t\t\tvar zipFile = new ZipFile(util,item,self);\r\n\t\t\tobjFiles[path] = {item: item,zipFile: zipFile};\r\n\t\t\t\r\n\t\t\treturn zipFile;\r\n\t\t};\r\n\t\t\r\n\t\tvar getContent = function(item)\r\n\t\t{\r\n\t\t\tvar refine = function(data)\r\n\t\t\t{\r\n\t\t\t\tvar dataType = item.dataType;\r\n\t\t\t\tif(dataType)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(dataType === \"string\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(item.isBase64)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdata = util.base64Decode(data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(item.isBinary)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t/*var arrData = new Uint8Array(data.length);\r\n\t\t\t\t\t\t\tdata = util.fillArrayWithString(data,arrData);*/\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (dataType === \"arraybuffer\") \r\n\t\t\t\t\t{\r\n\t\t\t            data = new Uint8Array(item);\r\n\t\t\t        }\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tconsole.warn(\"DataType cannot be detected for file \" + item.path);\r\n\t\t\t\t}\r\n\t\t\t\treturn data;\r\n\t\t\t};\r\n\t\t\tvar content = item.content;\r\n\t\t\tvar isBlob = (content instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(content)) !== -1);\r\n\t        if(isBlob && typeof FileReader !== \"undefined\") \r\n\t        {\r\n\t        \treturn new Promise(function (resolve, reject) \r\n\t        \t{\r\n\t                var reader = new FileReader();\r\n\t                reader.onload = function(event) \r\n\t                {\r\n\t                \titem.content = refine(event.target.result);\r\n\t                \tresolve(event.target.result);\r\n\t                };\r\n\t                reader.onerror = function(event) \r\n\t                {\r\n\t                \tconsole.error(event.target.error);\r\n\t                    reject(event.target.error);\r\n\t                };\r\n\t                reader.readAsArrayBuffer(content);\r\n\t        \t});\r\n\t        }\r\n\t        return refine(content);\r\n\t\t};\r\n\t\t\r\n\t\tvar clear = function()\r\n\t\t{\r\n\t\t     objFiles = {};\r\n\t\t};\r\n\t\t\r\n\t\tvar getBlob = function(mimeType)\r\n\t\t{\r\n\t\t\tmimeType = mimeType ? mimeType : \"application/zip\";\r\n\t\t\tvar textOutput = buildFileStream();\r\n\t\t\tvar uInt8Output  = util.buildUint8Array(textOutput);\r\n\t\t\tclear();\r\n\t\t\treturn new Blob([uInt8Output], { type: setting.mimeType });\r\n\t\t};\r\n\t\t\r\n\t\tvar buildFileStream = function(initContent)\r\n\t\t{\r\n\t\t\tinitContent = initContent ? initContent : \"\";\r\n\t\t\tvar len = Object.keys(objFiles).length;\r\n\t\t\tvar middleContent = \"\";\r\n\t\t\tvar lL = 0;\r\n\t        var cL = 0;\r\n\t        for(var path in objFiles)\r\n\t\t\t{\r\n\t        \tvar file = objFiles[path].item;\r\n\t\t\t\tvar objHeader = getHeader(file, lL);\r\n\t\t\t\tvar fileHeader = objHeader.fileHeader;\r\n\t\t\t\tvar folderHeader = objHeader.folderHeader;\r\n\t\t\t\tvar content = objHeader.content;\r\n\t\t\t\tlL += fileHeader.length + content.length;\r\n\t            cL += folderHeader.length;\r\n\t            initContent +=  fileHeader + content;\r\n\t            middleContent += folderHeader;\r\n\t\t\t}\r\n\t\t\tvar endContent = buildFolderEnd(len, cL, lL);\r\n\t        return initContent + middleContent + endContent;\r\n\t\t};\r\n\t\t\r\n\t\tvar getHeader = function(file,offset)\r\n\t\t{\r\n\t\t\tvar content = util.utf8_encode(file.content);\r\n\t\t\tvar path = file.path;\r\n\t\t\tvar created = file.created;\r\n\t\t\tvar utfPath = util.utf8_encode(path);\r\n\t\t\tvar isUTF8 = (utfPath !== path);\r\n\t\t\tvar time = util.convertTime(created);\r\n\t\t    var dt = util.convertDate(created);\r\n\t\t    var extraFields = \"\";\r\n\t\t    if (isUTF8) \r\n\t\t    {\r\n\t            var uExtraFieldPath = util.decToHex(1, 1) + util.decToHex(util.getFromCrc32Table(utfPath), 4) + utfPath;\r\n\t            extraFields = \"\\x75\\x70\" + util.decToHex(uExtraFieldPath.length, 2) + uExtraFieldPath;\r\n\t        }\r\n\t\t    var header = '\\x0A\\x00' +\r\n\t        (isUTF8 ? '\\x00\\x08' : '\\x00\\x00') + // general purpose bit flag\r\n\t        '\\x00\\x00' +\r\n\t        util.decToHex(time, 2) + // last modified time\r\n\t        util.decToHex(dt, 2) + // last modified date\r\n\t        util.decToHex(content ? util.getFromCrc32Table(content) : 0, 4) +\r\n\t        util.decToHex(content ? content.length : 0, 4) + // compressed size\r\n\t        util.decToHex(content ? content.length : 0, 4) + // uncompressed size\r\n\t        util.decToHex(utfPath.length, 2) + // file name length\r\n\t        util.decToHex(extraFields.length, 2); // extra field length\r\n\t        \r\n\t\t    var fileHeader = 'PK\\x03\\x04' + header + utfPath + extraFields;\r\n\t        var folderHeader = 'PK\\x01\\x02' + // central header\r\n\t            '\\x14\\x00' +\r\n\t            header + // file header\r\n\t            '\\x00\\x00' +\r\n\t            '\\x00\\x00' +\r\n\t            '\\x00\\x00' +\r\n\t            (content ? '\\x00\\x00\\x00\\x00' : '\\x10\\x00\\x00\\x00') + // external file attributes\r\n\t            util.decToHex(offset, 4) + // relative offset of local header\r\n\t            utfPath + // file name\r\n\t            extraFields; // extra field\r\n\t        return { fileHeader: fileHeader, folderHeader: folderHeader, content: content || '' };\r\n\t\t};\r\n\t\t\r\n\t\tvar buildFolderEnd = function(totalEntries,size,startOffset)\r\n\t\t{\r\n\t\t\tvar retValue = \"PK\\x05\\x06\" + \"\\x00\\x00\" + \"\\x00\\x00\";\r\n\t\t\tretValue += util.decToHex(totalEntries, 2);\r\n\t\t\tretValue += util.decToHex(totalEntries, 2);\r\n\t\t\tretValue += util.decToHex(size, 4);\r\n\t\t\tretValue += util.decToHex(startOffset, 4);\r\n\t\t\tretValue += \"\\x00\\x00\";\r\n\t\t\treturn retValue;\r\n\t\t};\r\n\t\t\r\n\t    var downloadFile = function(fileName,mimeType,type,content)\r\n\t    {\r\n\t    \tfileName = fileName ? fileName : \"download\";\r\n\t    \tif (fileName.indexOf(\".\") === -1) \r\n\t\t\t{\r\n\t\t\t\tfileName = fileName + \".zip\";\r\n\t        }\r\n\t    \tcontent = content ? content : getFile(type,mimeType);\r\n\t    \tutil.downloadFile(fileName,content);\r\n\t    };\r\n\t    \r\n\t    var ZipFile = function(util,item,objRoot)\r\n\t    {\r\n\t    \tvar self = this;\r\n\t    \t\r\n\t    \tvar addFolder = function(path)\r\n\t    \t{\r\n\t    \t\treturn objRoot.addFolder(getPath(path));\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar addFile = function(path,content)\r\n\t    \t{\r\n\t    \t\treturn objRoot.addFile(getPath(path),content);\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar getPath = function(path)\r\n\t    \t{\r\n\t    \t\treturn item.path + path;\r\n\t    \t};\r\n\t    \t\r\n\t    \tif(item.isDir)\r\n\t    \t{\r\n\t    \t\tself.addFolder = addFolder;\r\n\t    \t\tself.addFile = addFile;\r\n\t    \t}\r\n\t    };\r\n\t    \r\n\t    var ZipUtil = function()\r\n\t    {\r\n\t    \tvar self = this;\r\n\t    \tvar crcTable = [];\r\n\t    \tvar base64Key = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n\t    \t\r\n\t    \tvar initialize = function()\r\n\t    \t{\r\n\t    \t\tcrcTable = makeCRCTable();\r\n\t    \t};\r\n\t    \t\r\n\t    \t//https://stackoverflow.com/questions/18638900/javascript-crc32\r\n\t    \tvar makeCRCTable = function()\r\n\t    \t{\r\n\t    \t    var c;\r\n\t    \t    var crcTable = [];\r\n\t    \t    for(var n =0; n < 256; n++)\r\n\t    \t    {\r\n\t    \t        c = n;\r\n\t    \t        for(var k =0; k < 8; k++)\r\n\t    \t        {\r\n\t    \t            c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\r\n\t    \t        }\r\n\t    \t        crcTable[n] = c;\r\n\t    \t    }\r\n\t    \t    return crcTable;\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar getFromCrc32Table = function(content, crc)\r\n\t        {\r\n\t    \t\tif(typeof content === \"undefined\" || !content.length) \r\n\t    \t\t{\r\n\t    \t        return 0;\r\n\t    \t    }\r\n\t    \t\tif(!crc)\r\n\t        \t{\r\n\t        \t\tcrc = 0;\r\n\t        \t}\r\n\t        \tcrc ^= (-1);\r\n\t    \t\tvar dataType = util.getDataType(content);\r\n\t    \t\tif(dataType === \"string\")\r\n\t    \t\t{\r\n\t\t            var ch = 0;\r\n\t\t            var k = 0;\r\n\t\t            var l = 0;\r\n\t\t            var len = content.length;\r\n\t\t            for (var count = 0;count < len;count++) \r\n\t\t            {\r\n\t\t            \tch = content.charCodeAt(count);\r\n\t\t                k = (crc ^ ch) & 0xFF;\r\n\t\t                l = crcTable[k];\r\n\t\t                crc = (crc >>> 8) ^ l;\r\n\t\t            }\r\n\t    \t\t}\r\n\t    \t\telse\r\n\t    \t\t{\r\n\t    \t\t\tvar ch = 0;\r\n\t\t            var k = 0;\r\n\t\t            var l = 0;\r\n\t    \t\t\tvar len = content.length;\r\n\t    \t\t\tfor (var count = 0;count < len;count++) \r\n\t\t            {\r\n\t    \t\t\t\tch = content[count];\r\n\t    \t\t\t\tk = (crc ^ ch) & 0xFF;\r\n\t    \t\t\t\tl = crcTable[k];\r\n\t    \t\t\t\tcrc = (crc >>> 8) ^ l;\r\n\t\t            }\r\n\t    \t\t}\r\n\t    \t\treturn crc ^ (-1);\r\n\t        };\r\n\t        \r\n\t        var buildUint8Array = function(content)\r\n\t        {\r\n\t        \tvar retValue = new Uint8Array(content.length);\r\n\t            for (var count = 0; count < content.length; count++) \r\n\t            {\r\n\t            \tretValue[count] = content.charCodeAt(count);\r\n\t            }\r\n\t            return retValue;\r\n\t        };\r\n\t        \r\n\t        //http://www.navioo.com/javascript/tutorials/Javascript_utf8_encode_1529.html\r\n\t        // Encodes an ISO-8859-1 string to UTF-8    \r\n\t        var utf8_encode = function(str) \r\n\t    \t{\r\n\t        \tvar retValue = \"\";\r\n\t    \t\tvar str = str.replace(/\\r\\n/g, \"\\n\");\r\n\t    \t\tvar len = str.length;\r\n\t    \t\tvar start = 0;\r\n\t    \t\tvar end = 0;\r\n\t    \t\tvar enc = null;\r\n\t    \t\tvar ch = null;\r\n\t    \t\tfor(var count = 0;count < len;count++)\r\n\t    \t\t{\r\n\t    \t\t\tch = str.charCodeAt(count);\r\n\t    \t\t\tenc = null;\r\n\t    \t\t\tif(ch < 128)\r\n\t    \t\t\t{\r\n\t    \t\t\t\tend++;\r\n\t    \t\t\t}\r\n\t    \t\t\telse if(ch > 127 && ch < 2048)\r\n\t    \t\t\t{\r\n\t    \t\t\t\tenc = String.fromCharCode(ch >> 6 | 192);\r\n\t    \t\t\t\tenc += String.fromCharCode((ch & 63) | 128);\r\n\t    \t\t\t}\r\n\t    \t\t\telse\r\n\t    \t\t\t{\r\n\t    \t\t\t\tenc = String.fromCharCode((ch >> 12) | 224);\r\n\t    \t\t\t\tenc += String.fromCharCode(((ch >> 6) & 63) | 128);\r\n\t    \t\t\t\tenc += String.fromCharCode((ch & 63) | 128);\r\n\t    \t\t\t}\r\n\t    \t\t\tif (enc != null) \r\n\t    \t\t\t{  \r\n    \t\t            if (end > start) \r\n    \t\t            {  \r\n    \t\t            \tretValue += str.substring(start, end);  \r\n    \t\t            }  \r\n    \t\t            retValue += enc;  \r\n    \t\t            start = end = count + 1;  \r\n    \t\t        }  \r\n\t    \t\t}\r\n\t    \t\tif (end > start) \r\n\t    \t\t{  \r\n\t    \t\t\tretValue += str.substring(start,str.length);  \r\n\t    \t    } \r\n\t    \t\treturn retValue;\r\n\t        };\r\n\t        \r\n\t        //http://www.navioo.com/javascript/tutorials/Javascript_utf8_decode_1528.html\r\n\t        // Converts a UTF-8 encoded string to ISO-8859-1    \r\n\t        var utf8_decode = function(str) \r\n\t    \t{\r\n\t        \tvar arrReturn = [];\r\n\t        \tvar count = 0;\r\n\t        \tvar retCount = 0;\r\n\t        \tvar char1 = 0;\r\n\t        \tvar char2 = 0;\r\n\t        \tvar char3 = 0;  \r\n\t            str += \"\";  \r\n\t            while (count < str.length) \r\n\t            {  \r\n\t                char1 = str.charCodeAt(count);  \r\n\t                if (char1 < 128) \r\n\t                {  \r\n\t                    arrReturn[retCount++] = String.fromCharCode(char1);  \r\n\t                    count++;  \r\n\t                } \r\n\t                else if ((char1 > 191) && (char1 < 224)) \r\n\t                {  \r\n\t                    char2 = str.charCodeAt(count+1);  \r\n\t                    arrReturn[retCount++] = String.fromCharCode(((char1 & 31) << 6) | (char2 & 63));  \r\n\t                    count += 2;  \r\n\t                } \r\n\t                else \r\n\t                {  \r\n\t                    char2 = str.charCodeAt(count+1);  \r\n\t                    char3 = str.charCodeAt(count+2);  \r\n\t                    arrReturn[retCount++] = String.fromCharCode(((char1 & 15) << 12) | ((char2 & 63) << 6) | (char3 & 63));  \r\n\t                    count += 3;  \r\n\t                }  \r\n\t            }  \r\n\t            return arrReturn.join('');  \r\n\t    \t};\r\n\t        \r\n\t        var decToHex = function(number, bytes) \r\n\t        {\r\n\t        \tvar retValue = \"\";\r\n\t        \tfor(var count = 0;count < bytes;count++)\r\n\t    \t\t{\r\n\t        \t\tretValue += String.fromCharCode(number & 0xFF);\r\n\t        \t\tnumber = number >>> 8;\r\n\t    \t\t}\r\n\t        \treturn retValue;\r\n\t        };\r\n\t        \r\n\t        var fillArrayWithString = function(str,arrData) \r\n\t        {\r\n\t        \tfor (var count = 0;count < str.length;count++) \r\n\t        \t{\r\n\t        \t\tarrData[count] = str.charCodeAt(count) & 0xFF;\r\n\t            }\r\n\t            return arrData;\r\n\t        };\r\n\t        \r\n\t        var convertTime = function(date)\r\n\t        {\r\n\t        \t var hour = date.getUTCHours();\r\n\t        \t hour = hour << 6;\r\n\t        \t hour = hour | date.getUTCMinutes();\r\n\t        \t hour = hour << 5;\r\n\t        \t hour = hour | date.getUTCSeconds() / 2;\r\n\t        \t return hour;\r\n\t        };\r\n\t        \r\n\t        var convertDate = function(date)\r\n\t        {\r\n\t        \tvar retDate = date.getUTCFullYear() - 1980;\r\n\t        \tretDate = retDate << 4;\r\n\t        \tretDate = retDate | (date.getUTCMonth() + 1);\r\n\t        \tretDate = retDate << 5;\r\n\t        \tretDate = retDate | date.getUTCDate();\r\n\t        \treturn retDate;\r\n\t        };\r\n\t        \r\n\t        var addSlashAtEnd = function(path) \r\n\t    \t{\r\n\t    \t    if (path.slice(-1) !== \"/\") \r\n\t    \t    {\r\n\t    \t        path += \"/\";\r\n\t    \t    }\r\n\t    \t    return path;\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar getParentFolder = function(path) \r\n\t    \t{\r\n\t    \t    if (path.slice(-1) === '/') \r\n\t    \t    {\r\n\t    \t        path = path.substring(0, path.length - 1);\r\n\t    \t    }\r\n\t    \t    var lastSlash = path.lastIndexOf('/');\r\n\t    \t    return (lastSlash > 0) ? path.substring(0, lastSlash) : \"\";\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar getDataType = function(data) \r\n\t    \t{\r\n\t    \t    if (typeof data === \"string\") \r\n\t    \t    {\r\n\t    \t        return \"string\";\r\n\t    \t    }\r\n\t    \t    if (Object.prototype.toString.call(data) === \"[object Array]\") \r\n\t    \t    {\r\n\t    \t        return \"array\";\r\n\t    \t    }\r\n\t    \t    if (typeof Buffer !== \"undefined\" && data instanceof Buffer) \r\n\t    \t    {\r\n\t    \t        return \"nodebuffer\";\r\n\t    \t    }\r\n\t    \t    if (data instanceof Uint8Array) \r\n\t    \t    {\r\n\t    \t        return \"uint8array\";\r\n\t    \t    }\r\n\t    \t    if (data instanceof ArrayBuffer) \r\n\t    \t    {\r\n\t    \t        return \"arraybuffer\";\r\n\t    \t    }\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar base64Decode = function(data) \r\n\t    \t{\r\n\t    \t\tvar chr1, chr2, chr3;\r\n\t    \t    var enc1, enc2, enc3, enc4;\r\n\t    \t    var i = 0, resultIndex = 0;\r\n\t    \t    \r\n\t    \t    if(data.indexOf('base64,') > -1)\r\n\t    \t    {\r\n\t    \t    \tvar index = data.indexOf('base64,') + 'base64,'.length;\r\n\t\t    \t    data = data.substring(index);\r\n\t    \t    }\r\n\t    \t    data = data.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\r\n\t    \t    var totalLength = data.length * 3 / 4;\r\n\t    \t    if(data.charAt(data.length - 1) === base64Key.charAt(64)) \r\n\t    \t    {\r\n\t    \t        totalLength--;\r\n\t    \t    }\r\n\t    \t    if(data.charAt(data.length - 2) === base64Key.charAt(64)) \r\n\t    \t    {\r\n\t    \t        totalLength--;\r\n\t    \t    }\r\n\t    \t    //totalLength is base64 expected length\r\n\t    \t    if (totalLength % 1 !== 0) \r\n\t    \t    {\r\n\t    \t        throw new Error(\"Invalid base64 data\");\r\n\t    \t    }\r\n\t    \t    var retValue = new Uint8Array(totalLength|0);\r\n\t    \t    while (i < data.length) \r\n\t    \t    {\r\n\t    \t        enc1 = base64Key.indexOf(data.charAt(i++));\r\n\t    \t        enc2 = base64Key.indexOf(data.charAt(i++));\r\n\t    \t        enc3 = base64Key.indexOf(data.charAt(i++));\r\n\t    \t        enc4 = base64Key.indexOf(data.charAt(i++));\r\n\r\n\t    \t        chr1 = (enc1 << 2) | (enc2 >> 4);\r\n\t    \t        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\r\n\t    \t        chr3 = ((enc3 & 3) << 6) | enc4;\r\n\r\n\t    \t        retValue[resultIndex++] = chr1;\r\n\r\n\t    \t        if (enc3 !== 64) \r\n\t    \t        {\r\n\t    \t            retValue[resultIndex++] = chr2;\r\n\t    \t        }\r\n\t    \t        if (enc4 !== 64) \r\n\t    \t        {\r\n\t    \t            retValue[resultIndex++] = chr3;\r\n\t    \t        }\r\n\t    \t    }\r\n\r\n\t    \t    return retValue;\r\n\t    \t};\r\n\t    \t\r\n\t    \tvar downloadFile = function(fileName,content)\r\n\t        {\r\n\t        \tif (\"msSaveOrOpenBlob\" in window.navigator) \r\n\t        \t{\r\n\t                window.navigator.msSaveOrOpenBlob(content, fileName);\r\n\t            }\r\n\t            else \r\n\t            {\r\n\t                var element = document.createElement(\"a\");\r\n\t                var url = window.URL.createObjectURL(content);\r\n\t                element.setAttribute(\"href\", url);\r\n\t                element.setAttribute(\"download\", fileName);\r\n\t                element.style.display = \"none\";\r\n\t                document.body.appendChild(element);\r\n\t                element.click();\r\n\t                window.URL.revokeObjectURL(url);\r\n\t                document.body.removeChild(element);\r\n\t            }\r\n\t        };\r\n\t        \r\n\t        initialize();\r\n\t        \r\n\t        self.getFromCrc32Table = getFromCrc32Table;\r\n\t        self.buildUint8Array = buildUint8Array;\r\n\t        self.utf8_encode = utf8_encode;\r\n\t        self.utf8_decode = utf8_decode;\r\n\t        self.decToHex = decToHex;\r\n\t        self.fillArrayWithString = fillArrayWithString;\r\n\t        self.convertTime = convertTime;\r\n\t        self.convertDate = convertDate;\r\n\t        self.addSlashAtEnd = addSlashAtEnd;\r\n\t        self.getParentFolder = getParentFolder;\r\n\t        self.getDataType = getDataType;\r\n\t        self.base64Decode = base64Decode;\r\n\t        self.downloadFile = downloadFile;\r\n\t    };\r\n\t    \r\n\t\tinitialize();\r\n\t\t\r\n\t\tself.addFolder = addFolder;\r\n\t\tself.addFolders = addFolders;\r\n\t\tself.addFile = addFile;\r\n\t\tself.getBlob = getBlob;\r\n\t\tself.getFile = getFile;\r\n\t\tself.downloadFile = downloadFile;\r\n\t};\r\n\t\r\n\treturn NSZip;\r\n})();\r\nnsModuleExport(this,\"NSZip\",NSZip);var nsExtendPrototype = (function()\r\n{\r\n\tvar nsExtendPrototype = function(source,destination) \r\n\t{\r\n\t\tif(source && destination)\r\n\t\t{\r\n\t\t\tdestination.prototype = Object.create(source.prototype);\r\n\t\t\tdestination.prototype.constructor = destination;\r\n\t\t\tdestination.prototype.base = source.prototype;\r\n\t\t\treturn source.prototype;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\treturn nsExtendPrototype;\r\n})();\r\n\r\nvar NSDocxExport = (function()\r\n{\r\n\tvar NSDocxExport = function(config)\r\n\t{\r\n\t\tthis.__config = config;\r\n\t\tthis.util = null;\r\n\t\tthis.__exportUtil = null;\r\n\t\tthis.__setting = {};\r\n\t\tthis.__objOrientation = {};\r\n\t\tthis.__arrDefault = [];\r\n\t\tthis.__arrOverride = [];\r\n\t\tthis.__arrRelationship = [];\r\n\t\tthis.__relationshipID = 0;\r\n\t\tthis.__extraFiles = {};\r\n\t\tthis.__arrChildren = [];\r\n\t\tthis.__pageSection = null;\r\n\t\tthis.__styles = null;\r\n\t\tthis.__enableChunk = true;\r\n\t\t\r\n\t\tthis.__initialize();\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.process = function()\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar objPromise = new Promise(function(resolve,reject)\r\n\t\t{\r\n\t\t\tvar mimeType = \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\";\r\n\t\t\tvar zip = new NSZip();\r\n\t\t\tself.__save(zip).then(function(){\r\n\t\t\t\tzip.downloadFile(self.__setting.fileName,mimeType);\r\n\t\t\t\tresolve(true);\r\n\t\t\t}).catch(function(error){\r\n\t\t\t\treject(error);\r\n\t\t\t});\r\n\t\t});\r\n\t\treturn objPromise;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.addSection = function()\r\n\t{\r\n\t\tthis.__enableChunk = false;\r\n\t\tvar section = new Section(this);\r\n\t    this.__arrChildren.push(section)\r\n\t    return section;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.addParagraph = function(option)\r\n\t{\r\n\t\tthis.__enableChunk = false;\r\n\t\tvar paragraph = new Paragraph(this,option);\r\n\t    this.__arrChildren.push(paragraph)\r\n\t    return paragraph;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.addTable = function(option)\r\n\t{\r\n\t\tthis.__enableChunk = false;\r\n\t\tvar table = new Table(this,option);\r\n\t    this.__arrChildren.push(table)\r\n\t    return table;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.addHeader = function(type)\r\n\t{\r\n\t\t//this.__enableChunk = false;\r\n\t\tvar header = this.__pageSection.addHeader(type);\r\n\t    return header;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.addFooter = function(type)\r\n\t{\r\n\t\t//this.__enableChunk = false;\r\n\t\tvar footer = this.__pageSection.addFooter(type);\r\n\t    return footer;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.styles = function(value)\r\n\t{\r\n\t\tif(value && value instanceof Styles)\r\n\t\t{\r\n\t\t\tthis.__styles = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__styles && (this.__styles = new Styles(this,value));\r\n\t\t}\r\n\t\treturn this.__styles;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.getPageSection = function()\r\n\t{\r\n\t\treturn this.__pageSection;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__initialize = function()\r\n\t{\r\n\t\tif(!this.__config)\r\n\t\t{\r\n\t\t\tthis.__config = {};\r\n\t\t}\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.__exportUtil = new ExportUtil(this.util);\r\n\t\tthis.__setting = {\r\n\t\t\tfileName: this.__config[\"fileName\"] || \"download\",\r\n\t\t\thtmlSetting: this.__config[\"htmlSetting\"],\r\n\t\t\tprintSetting: this.__config[\"printSetting\"],\r\n\t\t\tstyles: this.__config[\"styles\"],\r\n\t\t};\r\n\t\tthis.__setHtmlSetting();\r\n\t\tthis.__setPrintSetting();\r\n\t\tthis.__initMargins();\r\n\t\tthis.__initOrientation();\r\n\t\tthis.__pageSection = new Section(this);\r\n\t\tif(this.__setting.fileName.indexOf(\".\") === -1) \r\n\t\t{\r\n\t\t\tthis.__setting.fileName = this.__setting.fileName + \".docx\";\r\n        }\r\n\t\tvar arrStyles = this.__getDefaultStyle();\r\n\t\tvar styles = this.__setting.styles || {};\r\n\t\tif(styles.styles && styles.styles.length)\r\n\t\t{\r\n\t\t\tarrStyles = arrStyles.concat(styles.styles);\r\n\t\t}\r\n\t\tstyles.styles = arrStyles;\r\n\t\tthis.styles(styles);\r\n\t};\r\n\t\r\n\t//by default TableNormal and TableGrid are available for table\r\n\tNSDocxExport.prototype.__getDefaultStyle = function()\r\n\t{\r\n\t\tvar arrDefault = [];\r\n\t\tvar tblNormal = {\r\n\t            id: \"TableNormal\",\r\n\t            type: \"table\",\r\n\t            name: \"Normal Table\",\r\n\t            basedOn: \"Normal\",\r\n\t            uiPriority: \"99\",\r\n\t            semiHidden: true,\r\n\t            unhideWhenUsed: true,\r\n\t            quickFormat: true,\r\n\t            table: {\r\n\t            \tcellMargin: { top: {width: 0,type: \"dxa\"}, \r\n\t            \t\t\t\t  left: {width: 108,type: \"dxa\"},\r\n\t            \t\t\t\t  bottom: {width: 0,type: \"dxa\"}, \r\n\t            \t\t\t\t  right: {width: 108,type: \"dxa\"}, \r\n\t            \t\t\t\t},\r\n\t            },\r\n\t        };\r\n\t\tarrDefault.push(tblNormal);\r\n\t\tvar tblGrid = {\r\n\t            id: \"TableGrid\",\r\n\t            type: \"table\",\r\n\t            name: \"Table Grid\",\r\n\t            basedOn: \"TableNormal\",\r\n\t            uiPriority: \"59\",\r\n\t            paragraph:{spacing: { after: 0 },},\r\n\t            table: {\r\n\t            \tborders: {top: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t  left: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t  bottom: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t  right: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t  insideH: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t  insideV: {color: \"auto\",space: 0,size: 4,value: \"single\"},\r\n\t            \t\t\t },\r\n\t            \tcellMargin: { top: {width: 0,type: \"dxa\"}, \r\n\t            \t\t\t\t  left: {width: 108,type: \"dxa\"},\r\n\t            \t\t\t\t  bottom: {width: 0,type: \"dxa\"}, \r\n\t            \t\t\t\t  right: {width: 108,type: \"dxa\"}, \r\n\t            \t\t\t\t},\r\n\t            },\r\n\t        };\r\n\t\tarrDefault.push(tblGrid);\r\n\t\treturn arrDefault;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__setPrintSetting  = function()\r\n\t{\r\n\t\tvar printSetting = this.__setting.printSetting || {};\r\n\t\tthis.__setting.printSetting = {\r\n\t\t\t\torientation: printSetting[\"orientation\"] || \"portrait\",\r\n\t\t\t\tmargins: printSetting[\"margins\"]\r\n\t\t};\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__initOrientation = function()\r\n\t{\r\n\t\tthis.__objOrientation = {landscape:{width: 16838,height: 11906,orientation: \"landscape\"},\r\n\t\t\t\t\t\t  portrait:{width: 11906,height: 16838,orientation: \"portrait\"},\r\n\t\t\t\t\t\t };\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__initMargins = function()\r\n\t{\r\n\t\t/*var margins = this.__setting.printSetting.margins;\r\n\t\tif(margins)\r\n\t\t{\r\n\t\t\tthis.__setting.printSetting.margins = {\r\n\t\t\t\t\t top: this.util.isUndefinedOrNull(margins[\"top\"]) ? null : parseInt(margins[\"top\"]),\r\n\t\t\t\t     right: this.util.isUndefinedOrNull(margins[\"right\"]) ? null : parseInt(margins[\"right\"]),\r\n\t\t\t\t     bottom: this.util.isUndefinedOrNull(margins[\"bottom\"]) ? null : parseInt(margins[\"bottom\"]),\r\n\t\t\t\t     left: this.util.isUndefinedOrNull(margins[\"left\"]) ? null : parseInt(margins[\"left\"]),\r\n\t\t\t\t     header: this.util.isUndefinedOrNull(margins[\"header\"]) ? null : parseInt(margins[\"header\"]),\r\n\t\t\t\t     footer: this.util.isUndefinedOrNull(margins[\"footer\"]) ? null : parseInt(margins[\"footer\"]),\r\n\t\t\t\t     gutter: this.util.isUndefinedOrNull(margins[\"gutter\"]) ? null: parseInt(margins[\"gutter\"]),\t\r\n\t\t\t};\r\n\t\t}*/\r\n\t\tvar margins = this.__setting.printSetting.margins || {};\r\n\t\tthis.__setting.printSetting.margins = {\r\n\t\t\t top: this.util.isUndefinedOrNull(margins[\"top\"]) ? 1440 : parseInt(margins[\"top\"]),\r\n\t\t     right: this.util.isUndefinedOrNull(margins[\"right\"]) ? 1440 : parseInt(margins[\"right\"]),\r\n\t\t     bottom: this.util.isUndefinedOrNull(margins[\"bottom\"]) ? 1440 : parseInt(margins[\"bottom\"]),\r\n\t\t     left: this.util.isUndefinedOrNull(margins[\"left\"]) ? 1440 : parseInt(margins[\"left\"]),\r\n\t\t     header: this.util.isUndefinedOrNull(margins[\"header\"]) ? 708 : parseInt(margins[\"header\"]),\r\n\t\t     footer: this.util.isUndefinedOrNull(margins[\"footer\"]) ? 708 : parseInt(margins[\"footer\"]),\r\n\t\t     gutter: this.util.isUndefinedOrNull(margins[\"gutter\"]) ? 0: parseInt(margins[\"gutter\"]),\t\r\n\t\t};\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__save = function(zip)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar resolveOtherFiles = function()\r\n\t\t{\r\n\t\t\tword.addFile(\"document.xml\",self.__getDocumentFile());\r\n\t\t\tif(self.__styles)\r\n\t\t\t{\r\n\t\t\t\tvar styleXml = self.__styles.toXml();\r\n\t\t\t\tif(styleXml)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__addFile(null,\"styles.xml\",\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\",\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\")\r\n\t\t\t\t\tconsole.log(styleXml);\r\n\t\t\t\t\tword.addFile(\"styles.xml\",styleXml);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tword.addFile(\"numbering.xml\",);\r\n\t\t\tvar wordRels = word.addFolder(\"_rels\");\r\n\t\t\twordRels.addFile(\"document.xml.rels\",self.__getWordRels());\r\n\t\t\tzip.addFile(\"_rels/.rels\", self.__getRels());\r\n\t\t\tzip.addFile(\"[Content_Types].xml\", self.__getContentTypesXml());\r\n\t\t\tself.__addExtraFiles.call(self,zip,word);\r\n\t\t};\r\n\t\tvar objPromise = null;\r\n\t\tvar word = zip.addFolder(\"word\");\r\n\t\tif(this.__isChunk())\r\n\t\t{\r\n\t\t\tobjPromise = new Promise(function(resolve,reject)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tself.__getHtmlContent(word).then(function(data){\r\n\t\t\t\t\tif(data)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.__addFile(null,\"afchunk.mht\",\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk\",\"message/rfc822\")\r\n\t\t\t\t\t\t//self.__arrOverride.push({partName:\"/word/afchunk.mht\",contentType:\"message/rfc822\"});\r\n\t\t\t\t\t\t//self.__arrRelationship.push({id:\"htmlChunk\",type:\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk\",target:\"/word/afchunk.mht\"});\r\n\t\t\t\t\t\tword.addFile(\"afchunk.mht\",data);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tresolveOtherFiles();\r\n\t\t\t\t\tresolve(true);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t\r\n\t\t\tobjPromise = new Promise(function(resolve,reject)\r\n\t\t\t{\r\n\t\t\t\tresolveOtherFiles();\r\n\t\t\t\tresolve(true);\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn objPromise;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getContentTypesXml = function()\r\n\t{\r\n\t\tvar isChunk = this.__isChunk();\r\n\t\tvar objDefault = {rels:{extension:\"rels\",contentType:\"application/vnd.openxmlformats-package.relationships+xml\",isDefault:true},\r\n\t\t\t\t\t\t  xml:{extension:\"xml\",contentType:\"application/xml\",isDefault:true},\r\n\t\t\t\t\t\t  png:{extension:\"png\",contentType:\"image/png\",isDefault:!isChunk},\r\n\t\t\t\t\t\t  jpeg:{extension:\"jpeg\",contentType:\"image/jpeg\",isDefault:!isChunk},\r\n\t\t\t\t\t\t  jpg:{extension:\"jpg\",contentType:\"image/jpeg\",isDefault:!isChunk},\r\n\t\t\t\t\t\t  bmp:{extension:\"bmp\",contentType:\"image/bmp\",isDefault:!isChunk},\r\n\t\t\t\t\t\t  gif:{extension:\"gif\",contentType:\"image/gif\",isDefault:!isChunk}\r\n\t\t};\r\n\t\tvar objOverride = {document:{partName:\"/word/document.xml\",contentType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"},\r\n\t\t\t\t\t\t  };\r\n\t\t\r\n\t\tvar arrChild = [];\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar count = 0;\r\n\t\tfor(key in objDefault)\r\n\t\t{\r\n\t\t\titem = objDefault[key];\r\n\t\t\tif(item.isDefault)\r\n\t\t\t{\r\n\t\t\t\tarrChild.push(this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"Default\",\r\n\t\t\t\t\tattributes: {\"Extension\": item.extension,\"ContentType\": item.contentType}\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(count = 0;count < this.__arrDefault.length;count++)\r\n\t\t{\r\n\t\t\titem = objDefault[this.__arrDefault[count]];\r\n\t\t\tif(item && !item.isDefault)\r\n\t\t\t{\r\n\t\t\t\tarrChild.push(this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"Default\",\r\n\t\t\t\t\tattributes: {\"Extension\": item.extension,\"ContentType\": item.contentType}\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(key in objOverride)\r\n\t\t{\r\n\t\t\titem = objOverride[key];\r\n\t\t\tarrChild.push(this.__exportUtil.getXML({\r\n\t\t\t\tname: \"Override\",\r\n\t\t\t\tattributes: {\"PartName\": item.partName,\"ContentType\": item.contentType}\r\n\t\t\t}));\r\n\t\t}\r\n\t\tfor(count = 0;count < this.__arrOverride.length;count++)\r\n\t\t{\r\n\t\t\titem = this.__arrOverride[count];\r\n\t\t\tif(item && !item.isDefault)\r\n\t\t\t{\r\n\t\t\t\tarrChild.push(this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"Override\",\r\n\t\t\t\t\tattributes: {\"PartName\": item.partName,\"ContentType\": item.contentType}\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.__exportUtil.getXML({\r\n\t\t\tname: \"Types\",\r\n\t\t\tns: \"contentTypes\",\r\n\t\t\tchildren: arrChild\r\n\t\t});\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getRels = function()\r\n\t{\r\n\t\tvar rels = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\\n ' +\r\n\t\t'<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\\n ' +\r\n\t\t'<Relationship Id=\"Id1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"/word/document.xml\"/>\\n ' +\r\n\t\t'</Relationships>';\r\n\t\t\r\n\t\treturn rels;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getDocumentFile = function()\r\n\t{\r\n\t\tvar printSetting = this.__setting.printSetting;\r\n\t\tvar orientation = printSetting.orientation;\r\n\t\tif(orientation)\r\n\t\t{\r\n\t\t\tvar itemOrient = this.__objOrientation[orientation.toLowerCase()];\r\n\t\t\tif(itemOrient)\r\n\t\t\t{\r\n\t\t\t\tvar pageSize = this.__pageSection.pgSz();\r\n\t\t\t\tpageSize.width(itemOrient.width);\r\n\t\t\t\tpageSize.height(itemOrient.height);\r\n\t\t\t\tpageSize.orientation(itemOrient.orientation);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.util.throwNSError(\"NSDocxExport\",\"Orientation entered is not valid\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar margins = this.__setting.printSetting.margins;\r\n\t\tif(margins)\r\n\t\t{\r\n\t\t\tvar pageMargins = this.__pageSection.pgMar();\r\n\t\t\tpageMargins.top(margins.top);\r\n\t\t\tpageMargins.right(margins.right);\r\n\t\t\tpageMargins.bottom(margins.bottom);\r\n\t\t\tpageMargins.left(margins.left);\r\n\t\t\tpageMargins.header(margins.header);\r\n\t\t\tpageMargins.footer(margins.footer);\r\n\t\t\tpageMargins.gutter(margins.gutter);\r\n\t\t}\r\n\t\t\t\t\r\n\t\tvar objDocAttr =  {\"xmlns:w\":\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\",\r\n\t\t\t\t  \t\t   \"xmlns:m\":\"http://schemas.openxmlformats.org/officeDocument/2006/math\",\r\n\t\t\t\t\t\t   \"xmlns:r\":\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\",\r\n\t\t\t\t\t\t   \"xmlns:wp\":\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\",\r\n\t\t\t\t\t\t   \"xmlns:a\":\"http://schemas.openxmlformats.org/drawingml/2006/main\",\r\n\t\t\t\t\t\t   \"xmlns:ns6\":\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\",\r\n\t\t\t\t\t\t   \"xmlns:c\":\"http://schemas.openxmlformats.org/drawingml/2006/chart\",\r\n\t\t\t\t\t\t   \"xmlns:ns8\":\"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing\",\r\n\t\t\t\t\t\t   \"xmlns:dgm\":\"http://schemas.openxmlformats.org/drawingml/2006/diagram\",\r\n\t\t\t\t\t\t   \"xmlns:pic\":\"http://schemas.openxmlformats.org/drawingml/2006/picture\",\r\n\t\t\t\t\t\t   \"xmlns:ns11\":\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\",\r\n\t\t\t\t\t\t   \"xmlns:dsp\":\"http://schemas.microsoft.com/office/drawing/2008/diagram\",\r\n\t\t\t\t\t\t   \"xmlns:ns13\":\"urn:schemas-microsoft-com:office:excel\",\r\n\t\t\t\t\t\t   \"xmlns:o\":\"urn:schemas-microsoft-com:office:office\",\r\n\t\t\t\t\t\t   \"xmlns:v\":\"urn:schemas-microsoft-com:vml\",\r\n\t\t\t\t\t\t   \"xmlns:w10\":\"urn:schemas-microsoft-com:office:word\",\r\n\t\t\t\t\t\t   \"xmlns:ns17\":\"urn:schemas-microsoft-com:office:powerpoint\",\r\n\t\t\t\t\t\t   \"xmlns:odx\":\"http://opendope.org/xpaths\",\r\n\t\t\t\t\t\t   \"xmlns:odc\":\"http://opendope.org/conditions\",\r\n\t\t\t\t\t\t   \"xmlns:odq\":\"http://opendope.org/questions\",\r\n\t\t\t\t\t\t   \"xmlns:odi\":\"http://opendope.org/components\",\r\n\t\t\t\t\t\t   \"xmlns:odgm\":\"http://opendope.org/SmartArt/DataHierarchy\",\r\n\t\t\t\t\t\t   \"xmlns:ns24\":\"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\",\r\n\t\t\t\t\t\t   \"xmlns:ns25\":\"http://schemas.openxmlformats.org/drawingml/2006/compatibility\",\r\n\t\t\t\t\t\t   \"xmlns:ns26\":\"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas\"\r\n\t\t};\r\n\t\tvar arrBody = [];\r\n\t\tif(this.__isChunk())\r\n\t\t{\r\n\t\t\tvar id = null;\r\n\t\t\tfor(var count = 0;count < this.__arrRelationship.length;count++)\r\n\t\t\t{\r\n\t\t\t\tif(this.__arrRelationship[count].target == \"afchunk.mht\")\r\n\t\t\t\t{\r\n\t\t\t\t\tid = this.__arrRelationship[count].id;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(id)\r\n\t\t\t{\r\n\t\t\t\tarrBody.push(\"<w:altChunk r:id=\\\"\" + id + \"\\\" />\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar arrChildren = this.__getWordChildren();\r\n\t\t\tarrBody = arrBody.concat(arrChildren);\r\n\t\t}\r\n\t\tarrBody.push(this.__pageSection.toXml());\r\n\t\tvar body = this.__exportUtil.getXML({\r\n\t\t\tname: 'w:body',\r\n\t\t\tchildren: arrBody\r\n\t\t});\r\n\t\tconsole.log(body);\r\n\t\treturn this.__exportUtil.getXML({\r\n\t\t\tname: 'w:document',\r\n\t\t\taddXmlPrefix: true,\r\n\t\t\tattributes: objDocAttr,\r\n\t\t\tchildren: [body]\r\n\t\t});\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getWordRels = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar arrChild = [];\r\n\t\tfor(var count = 0;count < this.__arrRelationship.length;count++)\r\n\t\t{\r\n\t\t\titem = this.__arrRelationship[count];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tarrChild.push(this.__exportUtil.getXML({\r\n\t\t\t\t\tname: 'Relationship',\r\n\t\t\t\t\tattributes: {'Id': item.id,'Type': item.type,'Target': item.target}\r\n\t\t\t\t}));\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar relationships = this.__exportUtil.getXML({\r\n\t\t\tname: 'Relationships',\r\n\t\t\taddXmlPrefix: true,\r\n\t\t\tattributes: {xmlns:\"http://schemas.openxmlformats.org/package/2006/relationships\"},\r\n\t\t\tchildren: arrChild\r\n\t\t});\r\n\t\treturn relationships;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__addExtraFiles = function(zip,word)\r\n\t{\r\n\t\tif(this.__extraFiles && Object.keys(this.__extraFiles).length)\r\n\t\t{\r\n\t\t\tvar arrFile = [];\r\n\t\t\tvar item = null;\r\n\t\t\tvar xml = null;\r\n\t\t\tvar file = null;\r\n\t\t\tfor(var key in this.__extraFiles)\r\n\t\t\t{\r\n\t\t\t\tarrFile = this.__extraFiles[key];\r\n\t\t\t\tif(arrFile && arrFile.length)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = 0;count < arrFile.length;count++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\titem = arrFile[count];\r\n\t\t\t\t\t\tif(item)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfile = item.file;\r\n\t\t\t\t\t\t\tif(file)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif(this.util.isString(file))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\txml = file;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\txml = file.toXml();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(xml)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tconsole.log(xml);\r\n\t\t\t\t\t\t\t\t\tzip.addFile(item.path + item.fileName, xml);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__addFile = function(file,fileType,relationType,overrideType)\r\n\t{\r\n\t\tvar fileName = fileType;\r\n\t\tvar rId = null;\r\n\t\tif(file)\r\n\t\t{\r\n\t\t\tfileName = this.__addExtraFile(fileType,file)\r\n\t\t}\r\n\t\tif(fileName)\r\n\t\t{\r\n\t\t\trId = this.__addRelationship(file,relationType,fileName);\r\n\t\t\tthis.__addOverride(overrideType,\"/word/\" + fileName);\r\n\t\t\treturn {fileName: fileName,id: rId};\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__addExtraFile = function(fileType,file,path,ext)\r\n\t{\r\n\t\tif(fileType && file)\r\n\t\t{\r\n\t\t\tfileType = fileType.toLowerCase();\r\n\t\t\tif(!this.__extraFiles[fileType])\r\n\t\t\t{\r\n\t\t\t\tthis.__extraFiles[fileType] = [];\r\n\t\t\t}\r\n\t\t\text = ext || \"xml\";\r\n\t\t\tpath = path || \"word/\"\r\n\t\t\tvar fileName = fileType + (this.__extraFiles[fileType].length + 1) + \".\" + ext;\r\n\t\t\tthis.__extraFiles[fileType].push({file: file,fileName: fileName,path: path});\r\n\t\t\treturn fileName;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__addRelationship = function(file,type,target)\r\n\t{\r\n\t\tif(type && target)\r\n\t\t{\r\n\t\t\tvar id = \"rId\" + (++this.__relationshipID);\r\n\t\t\tthis.__arrRelationship.push({id:id,type:type,target:target});\r\n\t\t\treturn id;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__addOverride = function(contentType,partName)\r\n\t{\r\n\t\tif(contentType && partName)\r\n\t\t{\r\n\t\t\tthis.__arrOverride.push({contentType:contentType,partName:partName});\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__isChunk = function()\r\n\t{\r\n\t\t//return !(this.__arrChildren && this.__arrChildren.length)\r\n\t\treturn this.__enableChunk;\r\n\t};\r\n\t\r\n\t/* word related functions */\r\n\tNSDocxExport.prototype.__getWordChildren = function()\r\n\t{\r\n\t\tvar arrChildren = [];\r\n\t\tvar item = null;\r\n\t\tvar xml = null;\r\n\t\tvar length = this.__arrChildren.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\titem = this.__arrChildren[count];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isString(item))\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildren.push(item);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\txml = item.toXml();\r\n\t\t\t\t\tif(xml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrChildren.push(xml);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrChildren;\r\n\t};\r\n\t\r\n\t/* end of word related functions */\r\n\t\r\n\t/* html related functions */\r\n\t\r\n\tNSDocxExport.prototype.__setHtmlSetting  = function()\r\n\t{\r\n\t\tvar htmlSetting = this.__setting.htmlSetting || {};\r\n\t\tthis.__setting.htmlSetting = {\r\n\t\t\t\telement: htmlSetting[\"element\"],\r\n\t\t\t\thtml: htmlSetting[\"html\"],\r\n\t\t\t\thtmlStyle: htmlSetting[\"htmlStyle\"],\r\n\t\t\t\tpageBreakTag: htmlSetting[\"pageBreakTag\"],\r\n\t\t\t\tenablePageNumber: Boolean.parse(htmlSetting[\"enablePageNumber\"]),\r\n\t\t\t\tloopNodesCallback: htmlSetting[\"loopNodesCallback\"]// should be discouraged as it can be costly operation for large docs \r\n\t\t};\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getHtmlContent = function(wordFolder)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar objPromise = new Promise(function(resolve,reject)\r\n\t\t{\r\n\t\t\tvar htmlSetting = self.__setting.htmlSetting;\r\n\t\t\tif(htmlSetting.element || htmlSetting.html)\r\n\t\t\t{\r\n\t\t\t\tvar html = htmlSetting.html;\r\n\t\t\t\tif(!html)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar element = self.util.getElement(htmlSetting.element);\r\n\t\t\t\t\tif(element)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thtml = element.innerHTML;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.util.throwNSError(\"NSDocxExport\",\"Element does not exists as defined in config\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(html)\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__parseImages(html).then(function(objData){\r\n\t\t\t\t\t\tif(objData)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\thtml = objData.html;\r\n\t\t\t\t\t\t\tvar arrImages = objData.arrImages;\r\n\t\t\t\t\t\t\tvar styles = htmlSetting.htmlStyle || \"\";\r\n\t\t\t\t\t\t\tvar startHtml = \"\";\r\n\t\t\t\t\t\t\tvar endHtml = \"\";\r\n\t\t\t\t\t\t\tvar extraCSS = \"\";\r\n\t\t\t\t\t\t\tif(htmlSetting.enablePageNumber)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tstartHtml = \"<div class=\\\"Section1\\\">\";\r\n\t\t\t\t\t\t\t\tendHtml = \"<table id=\\\"hrdftrtbl\\\" border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\"> <tr> <td> <div style=\\\"mso-element:footer\\\" id=\\\"f1\\\"> <p class=\\\"MsoFooter\\\"> <table width=\\\"100%\\\" border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\"> <tr> <td align=\\\"center\\\" class=\\\"footer\\\"> <g:message code=\\\"offer.letter.page.label\\\"/> <span style=\\\"mso-field-code: PAGE \\\"></span> of <span style=\\\"mso-field-code: NUMPAGES \\\"></span> </td> </tr> </table> </p> </div> </td> </tr> </table> </div>\";\r\n\t\t\t\t\t\t\t\textraCSS = \"p.MsoHeader, li.MsoHeader, div.MsoHeader{     margin:0in;     margin-top:.0001pt;     mso-pagination:widow-orphan;     tab-stops:center 3.0in right 6.0in; } p.MsoFooter, li.MsoFooter, div.MsoFooter{     margin:0in 0in 1in 0in;     margin-bottom:.0001pt;     mso-pagination:widow-orphan;     tab-stops:center 3.0in right 6.0in; } .footer {     font-size: 9pt; } @page Section1{     size:8.5in 11.0in;     margin:0.5in 0.5in 0.5in 0.5in;     mso-header-margin:0.5in;     mso-header:h1;     mso-footer:f1;     mso-footer-margin:0.5in;     mso-paper-source:0; } div.Section1{     page:Section1; } table#hrdftrtbl{     margin:0in 0in 0in 9in; }\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\thtml = startHtml + html + endHtml;\r\n\t\t\t\t\t\t\tif(htmlSetting[\"pageBreakTag\"])\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\thtml = html.replaceAll(htmlSetting[\"pageBreakTag\"],\"<br clear=all style='mso-special-character:line-break;page-break-before:always'>\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tstyles = styles + extraCSS;\r\n\t\t\t\t\t\t\thtml = self.__getDocHtml(html,arrImages,styles);\r\n\t\t\t\t\t\t\tvar strData = self.__convertHtmlToMht(html);\r\n\t\t\t\t\t\t\tresolve(strData);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tresolve(null);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tresolve(null);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tself.util.debug(\"NSDocxExport\",\"Element and HTML are not defined in config\");\r\n\t\t\t\tresolve(null);\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn objPromise;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__parseImages = function(html)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar replacerCallback = function(match,contentType,contentEncoding,encodedContent) \r\n\t\t{\r\n\t\t      var index = arrImages.length;\r\n\t\t      var extension = contentType.split('/')[1];\r\n\t\t      var contentLocation = \"file:///C:/fake/image\" + index + \".\" + extension;\r\n\t\t      arrImages.push(getImageString(contentType,contentEncoding,contentLocation,encodedContent));\r\n\t\t      return \"\\\"\" + contentLocation + \"\\\"\";\r\n\t\t};\r\n\t\tvar getImageString = function(contentType,contentEncoding,contentLocation,encodedContent)\r\n\t\t{\r\n\t\t\tvar str = \"Content-Type:\" + self.__exportUtil.getNonNullString(contentType);\r\n\t\t\tstr += self.__exportUtil.newLine + \"Content-Transfer-Encoding: \" + self.__exportUtil.getNonNullString(contentEncoding);\r\n\t\t\tstr += self.__exportUtil.newLine + \"Content-Location: \" + self.__exportUtil.getNonNullString(contentLocation);\r\n\t\t\tstr += self.__exportUtil.newLine + self.__exportUtil.newLine + self.__exportUtil.getNonNullString(encodedContent);\r\n\t\t\tstr = \"------=mhtDocumentPart\" + self.__exportUtil.newLine + str + self.__exportUtil.newLine;\r\n\t\t\treturn str;\r\n\t\t};\r\n\t\tvar arrImages = [];\r\n\t\tvar regex = /\"data:(\\w+\\/\\w+);(\\w+),(\\S+)\"/g;\r\n\t\tvar objPromise = new Promise(function(resolve,reject)\r\n\t\t{\r\n\t\t\tif(html) \r\n\t\t\t{\r\n\t\t\t\tself.__replaceImagesByBase64(html).then(function(paramHtml){\r\n\t\t\t\t\thtml = paramHtml;\r\n\t\t\t\t\tif (!/<img/g.test(html)) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tresolve({html: html,arrImages: arrImages});\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thtml = html.replace(regex,replacerCallback);\r\n\t\t\t\t\t\tresolve({html: html,arrImages: arrImages});\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tresolve(null);\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn objPromise;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__replaceImagesByBase64 = function(html)\r\n\t{\r\n\t\tvar parser = new DOMParser();\r\n\t\tvar tempDoc = parser.parseFromString(html,\"text/html\");\r\n\t\tvar arrImages = tempDoc.querySelectorAll(\"img\");\r\n\t\tvar length = arrImages.length;\r\n\t\tvar resolved = 0;\r\n\t\tvar self = this;\r\n\t\tvar objPromise = new Promise(function(resolve,reject)\r\n\t\t{\r\n\t\t\tif(length)\r\n\t\t\t{\r\n\t\t\t\tvar increaseResolved = function()\r\n\t\t\t\t{\r\n\t\t\t\t\tresolved++;\r\n\t\t\t\t\tif(resolved == length)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tresolve(tempDoc.getElementsByTagName(\"html\")[0].outerHTML);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tfor(var count = 0;count < length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar img = arrImages[count];\r\n\t\t\t\t\tvar src = img.getAttribute(\"src\");\r\n\t\t\t\t\tif(!self.util.isBase64String(src))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar callback = function(paramImg,base64,orignalSrc,hasError,errorDetails)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//orignalSrc can be src or image itself\r\n\t\t\t\t\t\t\t//paramImg is always giving last image in the outer loop so that is why looping orignalSrc to find the image\r\n\t\t\t\t\t\t\tif(base64)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar tempImg = null;\r\n\t\t\t\t\t\t\t\tfor(var tempCount = 0;tempCount < length;tempCount++)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\ttempImg = arrImages[tempCount];\r\n\t\t\t\t\t\t\t\t\tif(tempImg == orignalSrc || tempImg.getAttribute(\"src\") == orignalSrc)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif(hasError)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tself.util.warning(\"NSDocxExport\",\"The image with source \" + tempImg.getAttribute(\"src\") + \" has issues.So it is getting deleted.The error detials are :: \" + errorDetails);\r\n\t\t\t\t\t\t\t\t\t\t\tif(tempImg.parentNode)\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\ttempImg.parentNode.removeChild(tempImg);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\ttempImg.setAttribute(\"src\",base64);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tincreaseResolved();\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tif(self.util.isSVGString(src))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tself.util.convertSvgToBase64(src,callback);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//sending img and not src as we have to also pass the width\r\n\t\t\t\t\t\t\t//this.util.convertImageToBase64(src,callback);\r\n\t\t\t\t\t\t\tself.util.convertImageToBase64(img,true).then(function(item){\r\n\t\t\t\t\t\t\t\tif(item)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tcallback(img,item.base64,item.param,item.hasError,item.errorDetails);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tincreaseResolved();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tincreaseResolved();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tresolve(tempDoc.getElementsByTagName(\"html\")[0].outerHTML);\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn objPromise;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__getDocHtml = function(html,arrImages,styles)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tfunction addStyle(paramStyle) \r\n\t\t{ \r\n            var css = doc.createElement(\"style\"); \r\n            css.setAttribute(\"id\",\"styleNSDocxExport\"); \r\n            css.setAttribute(\"type\",\"text/css\"); \r\n            if(css.styleSheet)\r\n            {\r\n            \tcss.styleSheet.cssText = styles; \r\n            }\r\n            else\r\n            {\r\n            \tcss.appendChild(doc.createTextNode(styles));\r\n            }\r\n            doc.getElementsByTagName(\"head\")[0].appendChild(css); \r\n        };\r\n        function loopElements()\r\n        {\r\n        \tif(self.__setting.htmlSetting.loopNodesCallback)\r\n        \t{\r\n        \t\tvar callback = self.__setting.htmlSetting.loopNodesCallback;\r\n        \t\tvar arrElement = doc.querySelectorAll(\"body *\");\r\n        \t\tvar length = arrElement.length;\r\n        \t\tfor(var count = 0;count < length;count++)\r\n        \t\t{\r\n        \t\t\tcallback(arrElement[count]);\r\n        \t\t}\r\n        \t}\r\n        };\r\n        var parser = new DOMParser();\r\n    \tvar doc = parser.parseFromString(html, \"text/html\");\r\n    \tloopElements();\r\n    \tif(styles)\r\n    \t{\r\n    \t\taddStyle(styles);\r\n    \t}\r\n\t\tvar content = doc.getElementsByTagName(\"html\")[0].outerHTML;\r\n\t\tcontent = content.replace(/\\=/g, '=3D');\r\n\t\tvar strImages = (arrImages && arrImages.length) ? arrImages.join(\"\") : \"\";\r\n\t\tcontent += this.__exportUtil.newLine + this.__exportUtil.newLine + this.__exportUtil.getNonNullString(strImages);\r\n\t\treturn content;\r\n\t};\r\n\t\r\n\tNSDocxExport.prototype.__convertHtmlToMht = function(html)\r\n\t{\r\n\t\tvar mimeTypeToAdd = 'MIME-Version: 1.0\\nContent-Type: multipart/related;\\n    type=\"text/html\";\\n    boundary=\"----=mhtDocumentPart\"\\nX-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.17609\\n\\nThis is a multi-part message in MIME format.\\n\\n------=mhtDocumentPart\\nContent-Type: text/html;\\n    charset=\"utf-8\"\\nContent-Transfer-Encoding: quoted-printable\\nContent-Location: file://\\\\\\\\fake\\\\document.html\\n\\n';\r\n\t    var endHtml = this.__exportUtil.newLine + this.__exportUtil.newLine + \"------=mhtDocumentPart--\" + this.__exportUtil.newLine;\r\n\t    return mimeTypeToAdd + html + endHtml;\r\n\t};\r\n\t\r\n\t/* end of html related functions */\r\n\t\r\n\tvar BaseElement = function()\r\n\t{\r\n\t};\r\n\t\r\n\tBaseElement.prototype.init = function(docxRef)\r\n\t{\r\n\t\tthis.util = new NSUtil();\r\n\t\tthis.__docxRef = docxRef;\r\n\t\tthis.__exportUtil = new ExportUtil(this.util);\r\n\t\tthis.__children = [];\r\n\t};\r\n\t\r\n\tBaseElement.prototype.getChildrenForXml = function()\r\n\t{\r\n\t\tvar arrChildren = [];\r\n\t\tvar item = null;\r\n\t\tvar xml = null;\r\n\t\tvar length = this.__children.length;\r\n\t\tfor(var count = 0;count < length;count++)\r\n\t\t{\r\n\t\t\titem = this.__children[count];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tif(this.util.isString(item))\r\n\t\t\t\t{\r\n\t\t\t\t\tarrChildren.push(item);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\txml = item.toXml.call(item);\r\n\t\t\t\t\tif(xml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tarrChildren.push(xml);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrChildren;\r\n\t};\r\n\t\r\n\tBaseElement.prototype.toXml = function(xmlTag,attributes)\r\n\t{\r\n\t\tvar arrChildren = this.getChildrenForXml();\r\n\t\tvar item = {name: xmlTag};\r\n\t\tif(arrChildren && arrChildren.length)\r\n\t\t{\r\n\t\t\titem.children = arrChildren;\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\titem.attributes = attributes;\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML(item);\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPstyles.php\r\n\tvar Styles = function(docxRef,option)\r\n\t{\r\n\t\tthis.__docDefaults = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Styles);\r\n\tStyles.prototype.constructor = Styles;\r\n\tNSDocxExport.prototype.Styles = Styles;\r\n\t\r\n\tStyles.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(option.default)\r\n\t\t\t{\r\n\t\t\t\tthis.setDefaultStyle(option.default);\r\n\t\t\t}\r\n\t\t\tif(option.styles)\r\n\t\t\t{\r\n\t\t\t\tvar arrStyle = option.styles;\r\n\t\t\t\tif(!this.util.isArray(arrStyle) && this.util.isObject(arrStyle))\r\n\t\t\t\t{\r\n\t\t\t\t\tarrStyle = [arrStyle];\r\n\t\t\t\t}\r\n\t\t\t\tvar style = null;\r\n\t\t\t\tfor(var count = 0;count < arrStyle.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tstyle = arrStyle[count];\r\n\t\t\t\t\tif(style)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.addStyle(style);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tStyles.prototype.setDefaultStyle = function(value)\r\n\t{\r\n\t\tif(value && value instanceof DefaultStyle)\r\n\t\t{\r\n\t\t\tthis.__docDefaults = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__docDefaults && (this.__docDefaults = new DefaultStyle(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__docDefaults;\r\n\t};\r\n\t\r\n\tStyles.prototype.addStyle = function(option)\r\n\t{\r\n\t\tvar style = new Style(this.__docxRef,option);\r\n\t\tthis.__children.push(style);\r\n\t\treturn style;\r\n\t};\r\n\t\r\n\tStyles.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__docDefaults)\r\n\t\t{\r\n\t\t\tthis.__children.push(this.__docDefaults);\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar attributes = {\r\n\t\t\t\t\t\"xmlns:mc\": \"http://schemas.openxmlformats.org/markup-compatibility/2006\",\r\n\t\t\t\t\t\"xmlns:r\": \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\",\r\n\t\t            \"xmlns:w\": \"http://schemas.openxmlformats.org/wordprocessingml/2006/main\",\r\n\t\t            \"xmlns:w14\": \"http://schemas.microsoft.com/office/word/2010/wordml\",\r\n\t\t            \"xmlns:w15\": \"http://schemas.microsoft.com/office/word/2012/wordml\",\r\n\t\t            \"xmlns:Ignorable\": \"w14 w15\"\r\n\t            };\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:styles\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPstyleDefaults.php\r\n\tvar DefaultStyle = function(docxRef,option)\r\n\t{\r\n\t\tthis.__paraDefault = null;\r\n\t\tthis.__textDefault = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,DefaultStyle);\r\n\tDefaultStyle.prototype.constructor = DefaultStyle;\r\n\tNSDocxExport.prototype.DefaultStyle = DefaultStyle;\r\n\t\r\n\tDefaultStyle.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(option.paragraph)\r\n\t\t\t{\r\n\t\t\t\tthis.setParaStyle(option.paragraph);\r\n\t\t\t}\r\n\t\t\tif(option.text)\r\n\t\t\t{\r\n\t\t\t\tthis.setTextStyle(option.text);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tDefaultStyle.prototype.setParaStyle = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphFormat)\r\n\t\t{\r\n\t\t\tthis.__paraDefault = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__paraDefault && (this.__paraDefault = new ParagraphFormat(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__paraDefault;\r\n\t};\r\n\t\r\n\tDefaultStyle.prototype.setTextStyle = function(value)\r\n\t{\r\n\t\tif(value && value instanceof RunFormat)\r\n\t\t{\r\n\t\t\tthis.__textDefault = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__textDefault && (this.__textDefault = new RunFormat(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__textDefault;\r\n\t};\r\n\t\r\n\tDefaultStyle.prototype.toXml = function()\r\n\t{\r\n\t\tvar childXml = null;\r\n\t\tif(this.__paraDefault)\r\n\t\t{\r\n\t\t\tchildXml = this.__paraDefault.toXml();\r\n\t\t\tchildXml = this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"w:pPrDefault\",\r\n\t\t\t\t\tchildren: [childXml],\r\n\t\t\t\t});\r\n\t\t\tthis.__children.push(childXml);\r\n\t\t}\r\n\t\tif(this.__textDefault)\r\n\t\t{\r\n\t\t\tchildXml = this.__textDefault.toXml();\r\n\t\t\tchildXml = this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"w:rPrDefault\",\r\n\t\t\t\t\tchildren: [childXml],\r\n\t\t\t\t});\r\n\t\t\tthis.__children.push(childXml);\r\n\t\t}\r\n\t\t\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:docDefaults\");\r\n\t\t\tconsole.log(xml);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPstyle.php\r\n\t//http://officeopenxml.com/WPstyleGenProps.php\r\n\tvar Style = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objAttr = {type: {value:null, method:\"type\" },\r\n\t\t\t\t\t\t  styleId: {value:null, method:\"styleId\" },\r\n\t\t\t\t\t\t  default: {value:null, method:\"default\" },\r\n\t\t\t\t\t\t  customStyle: {value:null, method:\"customStyle\" }\r\n\t\t\t\t\t};\r\n\t\tthis.__objProp = {name: {value:null, method:\"name\"},\r\n\t\t\t\t\t\t  basedOn: {value:null, method:\"basedOn\"},\r\n\t\t\t\t\t\t  next: {value:null, method:\"next\"},\r\n\t\t\t\t\t\t  link: {value:null, method:\"link\"},\r\n\t\t\t\t\t\t  uiPriority: {value:null, method:\"uiPriority\"},\r\n\t\t\t\t\t\t  hidden: {value:null, method:\"hidden\",isEmpty: true},\r\n\t\t\t\t\t\t  locked: {value:null, method:\"locked\",isEmpty: true},\r\n\t\t\t\t\t\t  semiHidden: {value:null, method:\"semiHidden\",isEmpty: true},\r\n\t\t\t\t\t\t  unhideWhenUsed: {value:null, method:\"unhideWhenUsed\",isEmpty: true},\r\n\t\t\t\t\t\t  qFormat: {value:null, method:\"quickFormat\",isEmpty: true},\r\n\t\t\t\t\t\t  autoRedefine: {value:null, method:\"autoRedefine\",isEmpty: true},\r\n\t\t\t\t\t\t  pPr: {value:null, method:\"paragraphFormat\", className: \"ParagraphFormat\"},\r\n\t\t\t\t\t\t  rPr: {value:null, method:\"runFormat\", className: \"RunFormat\"},\r\n\t\t\t\t\t\t  tblPr: {value:null, method:\"tableFormat\", className: \"TableFormat\"},\r\n\t\t\t\t\t};\r\n\t\t\t\t\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addSingleValueFunctions(this,this.__objAttr,null,docxRef);\r\n\t\tvar propCallback = function(value,paramItem,key,paramInstance)\r\n\t\t{\r\n\t\t\tif(paramItem.className)\r\n\t\t\t{\r\n\t\t\t\tif(value && value instanceof NSDocxExport.prototype[paramItem.className])\r\n\t\t\t\t{\r\n\t\t\t\t\tparamItem.value = value;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t!paramItem.value && (paramItem.value = new NSDocxExport.prototype[paramItem.className](docxRef,value));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tparamItem.value = value;\r\n\t\t\t}\r\n\t\t\treturn paramItem.value;\r\n\t\t};\r\n\t\tthis.__exportUtil.addFunctions(this,this.__objProp,null,propCallback,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Style);\r\n\tStyle.prototype.constructor = Style;\r\n\tNSDocxExport.prototype.Style = Style;\r\n\t\r\n\tStyle.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(option.id)\r\n\t\t\t{\r\n\t\t\t\tthis.styleId(option.id);\r\n\t\t\t}\r\n\t\t\tif(option.type)\r\n\t\t\t{\r\n\t\t\t\tthis.type(option.type);\r\n\t\t\t}\r\n\t\t\tif(option.isDefault)\r\n\t\t\t{\r\n\t\t\t\tthis.default(option.isDefault);\r\n\t\t\t}\r\n\t\t\tif(option.customStyle)\r\n\t\t\t{\r\n\t\t\t\tthis.customStyle(option.customStyle);\r\n\t\t\t}\r\n\t\t\tif(option.name)\r\n\t\t\t{\r\n\t\t\t\tthis.name(option.name);\r\n\t\t\t}\r\n\t\t\tif(option.basedOn)\r\n\t\t\t{\r\n\t\t\t\tthis.basedOn(option.basedOn);\r\n\t\t\t}\r\n\t\t\tif(option.next)\r\n\t\t\t{\r\n\t\t\t\tthis.next(option.next);\r\n\t\t\t}\r\n\t\t\tif(option.link)\r\n\t\t\t{\r\n\t\t\t\tthis.link(option.link);\r\n\t\t\t}\r\n\t\t\tif(option.uiPriority)\r\n\t\t\t{\r\n\t\t\t\tthis.uiPriority(option.uiPriority);\r\n\t\t\t}\r\n\t\t\tif(option.hidden)\r\n\t\t\t{\r\n\t\t\t\tthis.hidden(option.hidden);\r\n\t\t\t}\r\n\t\t\tif(option.locked)\r\n\t\t\t{\r\n\t\t\t\tthis.locked(option.locked);\r\n\t\t\t}\r\n\t\t\tif(option.semiHidden)\r\n\t\t\t{\r\n\t\t\t\tthis.semiHidden(option.semiHidden);\r\n\t\t\t}\r\n\t\t\tif(option.unhideWhenUsed)\r\n\t\t\t{\r\n\t\t\t\tthis.unhideWhenUsed(option.unhideWhenUsed);\r\n\t\t\t}\r\n\t\t\tif(option.quickFormat)\r\n\t\t\t{\r\n\t\t\t\tthis.quickFormat(option.quickFormat);\r\n\t\t\t}\r\n\t\t\tif(option.autoRedefine)\r\n\t\t\t{\r\n\t\t\t\tthis.autoRedefine(option.autoRedefine);\r\n\t\t\t}\r\n\t\t\tif(option.paragraph)\r\n\t\t\t{\r\n\t\t\t\tthis.paragraphFormat(option.paragraph);\r\n\t\t\t}\r\n\t\t\tif(option.run)\r\n\t\t\t{\r\n\t\t\t\tthis.runFormat(option.run);\r\n\t\t\t}\r\n\t\t\tif(option.table)\r\n\t\t\t{\r\n\t\t\t\tthis.tableFormat(option.table);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tStyle.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tif(item.className)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(item.value);\r\n\t\t\t\t}\r\n\t\t\t\telse if(item.isEmpty)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(\"<w:\" + key + \"/>\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(this.__exportUtil.getValXml(item.value,\"w:\" + key));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item.value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:style\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPheaders.php\r\n\tvar Header = function(docxRef)\r\n\t{\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__fileName = null;\r\n\t\tthis.__idRef = null;\r\n\t\tvar item = this.__docxRef.__addFile(this,\"header\",\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header\",\"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml\");\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tthis.__fileName = item.fileName;\r\n\t\t\tthis.__idRef = item.id;\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Header);\r\n\tHeader.prototype.constructor = Header;\r\n\tNSDocxExport.prototype.Header = Header;\r\n\t\r\n\tHeader.prototype.getRefID = function()\r\n\t{\r\n\t\treturn this.__idRef;\r\n\t};\r\n\t\r\n\tHeader.prototype.getFileName = function()\r\n\t{\r\n\t\treturn this.__fileName;\r\n\t};\r\n\t\r\n\tHeader.prototype.addParagraph = function(option)\r\n\t{\r\n\t\t var para = new Paragraph(this.__docxRef,option);\r\n\t\t this.__children.push(para);\r\n\t\t return para;\r\n\t};\r\n\t\r\n\tHeader.prototype.addTable = function(option)\r\n\t{\r\n\t\t var table = new Table(this.__docxRef,option);\r\n\t\t this.__children.push(table);\r\n\t\t return table;\r\n\t};\r\n\t\r\n\tHeader.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar attributes = {\r\n\t\t\t\t\t\"xmlns:wpc\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\",\r\n\t\t\t\t\t\"xmlns:mc\": \"http://schemas.openxmlformats.org/markup-compatibility/2006\",\r\n\t\t\t\t\t\"xmlns:o\": \"urn:schemas-microsoft-com:office:office\",\r\n\t\t\t\t\t\"xmlns:r\": \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\",\r\n\t\t\t\t\t\"xmlns:m\": \"http://schemas.openxmlformats.org/officeDocument/2006/math\",\r\n\t\t\t\t\t\"xmlns:v\": \"urn:schemas-microsoft-com:vml\",\r\n\t\t\t\t\t\"xmlns:wp14\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\",\r\n\t\t\t\t\t\"xmlns:wp\": \"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\",\r\n\t\t\t\t\t\"xmlns:w10\": \"urn:schemas-microsoft-com:office:word\",\r\n\t\t\t\t\t\"xmlns:w\": \"http://schemas.openxmlformats.org/wordprocessingml/2006/main\",\r\n\t\t\t\t\t\"xmlns:w14\": \"http://schemas.microsoft.com/office/word/2010/wordml\",\r\n\t\t\t\t\t\"xmlns:w15\": \"http://schemas.microsoft.com/office/word/2012/wordml\",\r\n\t\t\t\t\t\"xmlns:wpg\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\",\r\n\t\t\t\t\t\"xmlns:wpi\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\",\r\n\t\t\t\t\t\"xmlns:wne\": \"http://schemas.microsoft.com/office/word/2006/wordml\",\r\n\t\t\t\t\t\"xmlns:wps\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\",\r\n\t\t\t\t\t\"xmlns:cx\": \"http://schemas.microsoft.com/office/drawing/2014/chartex\",\r\n\t\t\t\t\t\"xmlns:cx1\": \"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\",\r\n\t\t\t\t\t\"xmlns:cx2\": \"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\",\r\n\t                \"xmlns:cx3\": \"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\",\r\n\t                \"xmlns:cx4\": \"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\",\r\n\t                \"xmlns:cx5\": \"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\",\r\n\t                \"xmlns:cx6\": \"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\",\r\n\t                \"xmlns:cx7\": \"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\",\r\n\t                \"xmlns:cx8\": \"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\",\r\n\t                \"xmlns:w16cid\": \"http://schemas.microsoft.com/office/word/2016/wordml/cid\",\r\n\t                \"xmlns:w16se\": \"http://schemas.microsoft.com/office/word/2015/wordml/symex\",\r\n\t            };\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:hdr\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPfooters.php\r\n\tvar Footer = function(docxRef)\r\n\t{\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__fileName = null;\r\n\t\tthis.__idRef = null;\r\n\t\tvar item = this.__docxRef.__addFile(this,\"footer\",\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer\",\"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml\");\r\n\t\tif(item)\r\n\t\t{\r\n\t\t\tthis.__fileName = item.fileName;\r\n\t\t\tthis.__idRef = item.id;\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Footer);\r\n\tFooter.prototype.constructor = Footer;\r\n\tNSDocxExport.prototype.Footer = Footer;\r\n\t\r\n\tFooter.prototype.getRefID = function()\r\n\t{\r\n\t\treturn this.__idRef;\r\n\t};\r\n\t\r\n\tFooter.prototype.getFileName = function()\r\n\t{\r\n\t\treturn this.__fileName;\r\n\t};\r\n\t\r\n\tFooter.prototype.addParagraph = function(option)\r\n\t{\r\n\t\t var para = new Paragraph(this.__docxRef,option);\r\n\t\t this.__children.push(para);\r\n\t\t return para;\r\n\t};\r\n\t\r\n\tFooter.prototype.addTable = function(option)\r\n\t{\r\n\t\t var table = new Table(this.__docxRef,option);\r\n\t\t this.__children.push(table);\r\n\t\t return table;\r\n\t};\r\n\t\r\n\tFooter.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar attributes = {\r\n\t\t\t\t\"xmlns:wpc\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\",\r\n                \"xmlns:mc\": \"http://schemas.openxmlformats.org/markup-compatibility/2006\",\r\n                \"xmlns:o\": \"urn:schemas-microsoft-com:office:office\",\r\n                \"xmlns:r\": \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\",\r\n                \"xmlns:m\": \"http://schemas.openxmlformats.org/officeDocument/2006/math\",\r\n                \"xmlns:v\": \"urn:schemas-microsoft-com:vml\",\r\n                \"xmlns:wp14\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\",\r\n                \"xmlns:wp\": \"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\",\r\n                \"xmlns:w10\": \"urn:schemas-microsoft-com:office:word\",\r\n                \"xmlns:w\": \"http://schemas.openxmlformats.org/wordprocessingml/2006/main\",\r\n                \"xmlns:w14\": \"http://schemas.microsoft.com/office/word/2010/wordml\",\r\n                \"xmlns:w15\": \"http://schemas.microsoft.com/office/word/2012/wordml\",\r\n                \"xmlns:wpg\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\",\r\n                \"xmlns:wpi\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\",\r\n                \"xmlns:wne\": \"http://schemas.microsoft.com/office/word/2006/wordml\",\r\n                \"xmlns:wps\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\",\r\n            }\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:ftr\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPnumbering.php\r\n\tvar Numbering = function(docxRef,option)\r\n\t{\r\n\t\tthis.__abstractNumID = 0;\r\n\t\tthis.__numID = 0;\r\n\t\tthis.__arrAbstractNum = [];\r\n\t\tthis.__arrNum = [];\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Numbering);\r\n\tNumbering.prototype.constructor = Numbering;\r\n\tNSDocxExport.prototype.Numbering = Numbering;\r\n\t\r\n\tNumbering.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tthis.levelOverride(option);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNumbering.prototype.__getAbstractNumID = function(fileRef)\r\n\t{\r\n\t\tvar retID = this.__abstractNumID;\r\n\t\tthis.__abstractNumID++;\r\n\t\treturn retID;\r\n\t};\r\n\t\r\n\tNumbering.prototype.__getNumID = function(fileRef)\r\n\t{\r\n\t\treturn ++this.__numID; \r\n\t};\r\n\t\r\n\tNumbering.prototype.addAbstractNumber = function(value)\r\n\t{\r\n\t\tvar abstractNumber = null;\r\n\t\tif(value && value instanceof AbstractNumbering) \r\n\t\t{\r\n\t\t\tabstractNumber = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tabstractNumber = new AbstractNumbering(this.__docxRef,this,value);\r\n\t\t}\r\n\t\tthis.__arrAbstractNum.push(abstractNumber);\r\n\t\tvar number = this.addNumber(null,abstractNumber);\r\n\t\treturn {abstractNumber: abstractNumber,number: number};\r\n\t};\r\n\t\r\n\tNumbering.prototype.addNumber = function(value,abstractNumber)\r\n\t{\r\n\t\tvar retValue = null;\r\n\t\tif(value && value instanceof ConcreteNumbering) \r\n\t\t{\r\n\t\t\tretValue = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tretValue = new ConcreteNumbering(this.__docxRef,this,abstractNumber,value);\r\n\t\t}\r\n\t\tthis.__arrNum.push(retValue);\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tNumbering.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar attributes = {\r\n\t\t\t\t\t\"xmlns:wpc\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\",\r\n\t\t\t\t\t\"xmlns:mc\": \"http://schemas.openxmlformats.org/markup-compatibility/2006\",\r\n\t\t            \"xmlns:o\": \"urn:schemas-microsoft-com:office:office\",\r\n\t\t            \"xmlns:r\": \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\",\r\n\t\t            \"xmlns:m\": \"http://schemas.openxmlformats.org/officeDocument/2006/math\",\r\n\t\t            \"xmlns:v\": \"urn:schemas-microsoft-com:vml\",\r\n\t\t            \"xmlns:wp14\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\",\r\n\t\t            \"xmlns:wp\": \"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\",\r\n\t\t            \"xmlns:w10\": \"urn:schemas-microsoft-com:office:word\",\r\n\t\t            \"xmlns:w\": \"http://schemas.openxmlformats.org/wordprocessingml/2006/main\",\r\n\t\t            \"xmlns:w14\": \"http://schemas.microsoft.com/office/word/2010/wordml\",\r\n\t\t            \"xmlns:w15\": \"http://schemas.microsoft.com/office/word/2012/wordml\",\r\n\t\t            \"xmlns:wpg\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\",\r\n\t\t            \"xmlns:wpi\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\",\r\n\t\t            \"xmlns:wne\": \"http://schemas.microsoft.com/office/word/2006/wordml\",\r\n\t\t            \"xmlns:wps\": \"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\",\r\n\t\t            \"xmlns:Ignorable\": \"w14 w15 wp14\",\r\n            }\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:numbering\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPnumbering.php\r\n\tvar ConcreteNumbering = function(docxRef,parent,abstractNum,option)\r\n\t{\r\n\t\tthis.__lvlOverride = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__parent = parent;\r\n\t\tthis.__abstractNum = abstractNum;\r\n\t\tthis.__id = this.__parent.__getNumID(this);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ConcreteNumbering);\r\n\tConcreteNumbering.prototype.constructor = ConcreteNumbering;\r\n\tNSDocxExport.prototype.ConcreteNumbering = ConcreteNumbering;\r\n\t\r\n\tConcreteNumbering.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tthis.levelOverride(option);\r\n\t\t}\r\n\t};\r\n\t\r\n\tConcreteNumbering.prototype.levelOverride = function(value)\r\n\t{\r\n\t\tif(value && value instanceof NumberingLevel) \r\n\t\t{\r\n\t\t\tthis.__lvlOverride = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__lvlOverride && (this.__lvlOverride = new LevelOverride(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__lvlOverride;\r\n\t};\r\n\t\r\n\tConcreteNumbering.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tattributes[\"w:numId\"] = this.__id;\r\n\t\tif(this.__abstractNum)\r\n\t\t{\r\n\t\t\tthis.__children.push(\"<w:abstractNumId w:val=\\\"\" + this.__abstractNum.getID() + \"\\\"/>\");\r\n\t\t}\r\n\t\tif(this.__lvlOverride)\r\n\t\t{\r\n\t\t\tthis.__children.push(this.__lvlOverride);\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:num\",attributes);\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPnumberingOverride.php\r\n\tvar LevelOverride = function(docxRef,option)\r\n\t{\r\n\t\tthis.__ilvl = null;\r\n\t\tthis.__lvl = null;\r\n\t\tthis.__startOverride = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,LevelOverride);\r\n\tLevelOverride.prototype.constructor = LevelOverride;\r\n\tNSDocxExport.prototype.LevelOverride = LevelOverride;\r\n\t\r\n\tLevelOverride.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(this.util.isUndefinedOrNull(option.numberingLevel))\r\n\t\t\t{\r\n\t\t\t\tthis.numberingLevel(option.numberingLevel);\r\n\t\t\t}\r\n\t\t\tif(this.util.isUndefinedOrNull(option.level))\r\n\t\t\t{\r\n\t\t\t\tthis.level(option.level);\r\n\t\t\t}\r\n\t\t\tif(this.util.isUndefinedOrNull(option.startOverride))\r\n\t\t\t{\r\n\t\t\t\tthis.startOverride(option.startOverride);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tLevelOverride.prototype.numberingLevel = function(value)\r\n\t{\r\n\t\tthis.__ilvl = value;\r\n\t\treturn this.__ilvl;\r\n\t};\r\n\t\r\n\tLevelOverride.prototype.level = function(value)\r\n\t{\r\n\t\tif(value && value instanceof AbstractNumbering) \r\n\t\t{\r\n\t\t\tthis.__lvl = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__lvl && (this.__lvl = new AbstractNumbering(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__lvl;\r\n\t};\r\n\t\r\n\tLevelOverride.prototype.startOverride = function(value)\r\n\t{\r\n\t\tthis.__startOverride = value;\r\n\t\treturn this.__startOverride;\r\n\t};\r\n\t\r\n\tLevelOverride.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tif(this.util.isUndefinedOrNull(this.__ilvl))\r\n\t\t{\r\n\t\t\tattributes[\"w:ilvl\"] = this.__ilvl;\r\n\t\t}\r\n\t\tif(this.__lvl)\r\n\t\t{\r\n\t\t\tthis.__children.push(this.__lvl);\r\n\t\t}\r\n\t\tif(this.__startOverride)\r\n\t\t{\r\n\t\t\tthis.__children.push(\"<w:startOverride w:val=\\\"\" + this.__startOverride + \"\\\"/>\");\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:lvlOverride\",attributes);\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t//http://officeopenxml.com/WPnumberingAbstractNum.php\r\n\tvar AbstractNumbering = function(docxRef,parent,option)\r\n\t{\r\n\t\tthis.__objAttr = {abstractNumId: {value:null, method:\"id\",tag:\"w:abstractNumId\" },\r\n\t\t\t\t  \t\t  restartNumberingAfterBreak: {value:null, method:\"restartNumberingAfterBreak\", tag:\"w15:restartNumberingAfterBreak\"},\r\n\t\t};\r\n\t\tthis.__objProp = {multiLevelType: {value:null, method:\"multiLevelType\"},\r\n\t\t\t\t\t\t  name: {value:null, method:\"name\"},\r\n\t\t\t\t\t\t  numStyleLink: {value:null, method:\"numStyleLink\"},\r\n\t\t\t\t\t\t  styleLink: {value:null, method:\"styleLink\"},\r\n\t\t};\r\n\t\tthis.__arrLevel = [];\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addSingleValueFunctions(this,this.__objAttr,null,docxRef);\r\n\t\tthis.__parent = parent;\r\n\t\tthis.__id = this.__parent.__getAbstractNumID(this);\r\n\t\tvar propCallback = function(value,paramItem,key,paramInstance)\r\n\t\t{\r\n\t\t\tparamItem.value = value;\r\n\t\t\treturn paramItem.value;\r\n\t\t};\r\n\t\tthis.__exportUtil.addFunctions(this,this.__objProp,null,propCallback,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,AbstractNumbering);\r\n\tAbstractNumbering.prototype.constructor = AbstractNumbering;\r\n\tNSDocxExport.prototype.AbstractNumbering = AbstractNumbering;\r\n\t\r\n\tAbstractNumbering.prototype.setProperties = function(option)\r\n\t{\r\n\t\tthis.abstractNumId(this.__id);\r\n\t\toption = option || {};\r\n\t\t!this.util.isUndefinedOrNull(option.restartNumberingAfterBreak) ? this.restartNumberingAfterBreak(option.restartNumberingAfterBreak) : this.restartNumberingAfterBreak(0);\r\n\t\t!this.util.isUndefinedOrNull(option.multiLevelType) ? this.multiLevelType(option.multiLevelType) : this.multiLevelType(\"hybridMultilevel\");\r\n\t\tif(option.name)\r\n\t\t{\r\n\t\t\tthis.name(option.name);\r\n\t\t}\r\n\t\tif(option.numStyleLink)\r\n\t\t{\r\n\t\t\tthis.numStyleLink(option.numStyleLink);\r\n\t\t}\r\n\t\tif(option.styleLink)\r\n\t\t{\r\n\t\t\tthis.styleLink(option.styleLink);\r\n\t\t}\r\n\t\tif(option.levels && option.levels.length)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < option.levels.length;count++)\r\n\t\t\t{\r\n\t\t\t\tthis.addLevel(option.levels[count]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tAbstractNumbering.prototype.getID = function()\r\n\t{\r\n\t\treturn this.__id;\r\n\t};\r\n\t\r\n\tAbstractNumbering.prototype.addLevel = function(value)\r\n\t{\r\n\t\tvar level = null;\r\n\t\tif(value && value instanceof NumberingLevel) \r\n\t\t{\r\n\t\t\tlevel = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tlevel = new NumberingLevel(this.__docxRef,value);\r\n\t\t}\r\n\t\tthis.__arrLevel.push(level);\r\n\t\treturn level;\r\n\t};\r\n\t\r\n\tAbstractNumbering.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tif(item.tag)\r\n\t\t\t\t{\r\n\t\t\t\t\tattributes[item.tag] = item.value;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tattributes[\"w:\" + key] = item.value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__exportUtil.getValXml(item.value,\"w:\" + key));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__arrLevel && this.__arrLevel.length)\r\n\t\t{\r\n\t\t\tfor(var count = 0;count < this.__arrLevel.length;count++)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__arrLevel[count]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:lvl\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPnumberingLvl.php\r\n\tvar NumberingLevel = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objAttr = {ilvl: {value:null, method:\"level\",tag:\"w:ilvl\" },\r\n\t\t\t\t\t\t  tentative: {value:null, method:\"tentative\", tag:\"w15:tentative\", isBoolean: true },\r\n\t\t};\r\n\t\tthis.__objProp = {start: {value:null, method:\"start\",attr:\"w:val\" },\r\n\t\t\t\t\t\t  numFmt: {value:null, method:\"numberFormat\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  lvlText: {value:null, method:\"levelText\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  lvlJc: {value:null, method:\"levelJc\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  pPr: {value:null, method:\"paragraphFormat\", className: \"ParagraphFormat\"},\r\n\t\t\t\t\t\t  rPr: {value:null, method:\"runFormat\", className: \"RunFormat\"},\r\n\t\t};\r\n\t\t\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addSingleValueFunctions(this,this.__objAttr,null,docxRef);\r\n\t\tvar propCallback = function(value,paramItem,key,paramInstance)\r\n\t\t{\r\n\t\t\tif(paramItem.className)\r\n\t\t\t{\r\n\t\t\t\tif(value && value instanceof NSDocxExport.prototype[paramItem.className])\r\n\t\t\t\t{\r\n\t\t\t\t\tparamItem.value = value;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t!paramItem.value && (paramItem.value = new NSDocxExport.prototype[paramItem.className](docxRef,value));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tparamItem.value = value;\r\n\t\t\t}\r\n\t\t\treturn paramItem.value;\r\n\t\t};\r\n\t\tthis.__exportUtil.addFunctions(this,this.__objProp,null,propCallback,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,NumberingLevel);\r\n\tNumberingLevel.prototype.constructor = NumberingLevel;\r\n\tNSDocxExport.prototype.NumberingLevel = NumberingLevel;\r\n\t\r\n\tNumberingLevel.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tthis.level(option.level);\r\n\t\t\t!this.util.isUndefinedOrNull(option.tentative) ? this.tentative(option.tentative) : this.tentative(true);\r\n\t\t\t!this.util.isUndefinedOrNull(option.start) ? this.start(option.start) : this.start(1);\r\n\t\t\tif(option.format) \r\n\t\t\t{\r\n\t            this.numberFormat(option.format);\r\n\t        }\r\n\t        if(option.text) \r\n\t        {\r\n\t            this.levelText(option.text);\r\n\t        }\r\n\t        !this.util.isUndefinedOrNull(option.alignment) ? this.levelJc(option.alignment) : this.levelJc(\"start\");\r\n\t        if(option.style)\r\n\t        {\r\n\t        \tif(option.style.paragraph)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.paragraphFormat(option.paragraph);\r\n\t\t\t\t}\r\n\t\t\t\tif(option.run)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.runFormat(option.run);\r\n\t\t\t\t}\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tNumberingLevel.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tif(item.className)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(item.value);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(this.__exportUtil.getValXml(item.value,\"w:\" + key));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tif(item.tag)\r\n\t\t\t\t{\r\n\t\t\t\t\tattributes[item.tag] = (item.isBoolean) ? (Boolean.parse(item.value) ? 1 : 0) : item.value;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tattributes[\"w:\" + key] = item.value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:lvl\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t\r\n\t//http://officeopenxml.com/WPtable.php\r\n\tvar Table = function(docxRef,option)\r\n\t{\r\n\t\tthis.__format = null;\r\n\t\tthis.__tblGrid = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Table);\r\n\tTable.prototype.constructor = Table;\r\n\tNSDocxExport.prototype.Table = Table;\r\n\t\r\n\tTable.prototype.setProperties = function(option)\r\n\t{\r\n\t\toption = option || {};\r\n\t\tthis.format(option);\r\n\t};\r\n\t\r\n\tTable.prototype.format = function(value)\r\n\t{\r\n\t\tif(value && value instanceof TableFormat) \r\n\t\t{\r\n\t\t\tthis.__format = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__format && (this.__format = new TableFormat(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__format;\r\n\t};\r\n\t\r\n\tTable.prototype.grid = function(value)\r\n\t{\r\n\t\tif(value && value instanceof TableGrid) \r\n\t\t{\r\n\t\t\tthis.__tblGrid = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__tblGrid && (this.__tblGrid = new TableGrid(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__tblGrid;\r\n\t};\r\n\t\r\n\tTable.prototype.addRow = function()\r\n\t{\r\n\t\tvar row = new TableRow(this.__docxRef);\r\n\t    this.__children.push(row);\r\n\t    return row;\r\n\t};\r\n\t\r\n\tTable.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__tblGrid)\r\n\t    {\t\r\n\t    \tthis.__children.unshift(this.__tblGrid);\r\n\t    }\r\n\t    if(this.__format)\r\n\t    {\t\r\n\t    \tthis.__children.unshift(this.__format);\r\n\t    }\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tbl\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableCell.php\r\n\tvar TableCell = function(docxRef)\r\n\t{\r\n\t\tthis.__format = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableCell);\r\n\tTableCell.prototype.constructor = TableCell;\r\n\tNSDocxExport.prototype.TableCell = TableCell;\r\n\t\r\n\tTableCell.prototype.format = function(value)\r\n\t{\r\n\t\tif(value && value instanceof TableCellFormat) \r\n\t\t{\r\n\t\t\tthis.__format = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__format && (this.__format = new TableCellFormat(this.__docxRef));\r\n\t\t}\r\n\t\treturn this.__format;\r\n\t};\r\n\t\r\n\tTableCell.prototype.addParagraph = function(option)\r\n\t{\r\n\t\t var para = new Paragraph(this.__docxRef,option);\r\n\t\t this.__children.push(para);\r\n\t\t return para;\r\n\t};\r\n\t\r\n\tTableCell.prototype.addTable = function(option)\r\n\t{\r\n\t\t var table = new Table(this.__docxRef,option);\r\n\t\t this.__children.push(table);\r\n\t\t return table;\r\n\t};\r\n\t\r\n\tTableCell.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__format)\r\n\t\t{\r\n\t\t\tthis.__children.unshift(this.__format);\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tc\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableCellProperties.php\r\n\tvar TableCellFormat = function(docxRef)\r\n\t{\r\n\t\tthis.__noWrap = false;\r\n\t\tthis.__objProp = {gridSpan: null,shading: null,tcBorders: null,tcFitText: null,tcMar: null,tcW: null,vAlign: null,vMerge: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableCellFormat);\r\n\tTableCellFormat.prototype.constructor = TableCellFormat;\r\n\tNSDocxExport.prototype.TableCellFormat = TableCellFormat;\r\n\t\r\n\tTableCellFormat.prototype.gridSpan = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp.gridSpan = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:gridSpan\",\r\n\t\t\t\tattributes: {\"w:val\": value},\r\n\t\t\t});\r\n\t\t}\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.noWrap = function(value)\r\n\t{\r\n\t\tthis.__noWrap = value;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.shading = function(value)\r\n\t{\r\n\t\tif(value && value instanceof Shading)\r\n\t\t{\r\n\t\t\tthis.__objProp.shading = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__objProp.shading && (this.__objProp.shading = new Shading(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__objProp.shading;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.fitText = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp.tcFitText = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:tcFitText\",\r\n\t\t\t\tattributes: {\"w:val\": value},\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this.__objProp.tcFitText;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.margins = function(value)\r\n\t{\r\n\t\tif(value && value instanceof TableCellMargins)\r\n\t\t{\r\n\t\t\tthis.__objProp.tcMar = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__objProp.tcMar && (this.__objProp.tcMar = new TableCellMargins(this.__docxRef));\r\n\t\t}\r\n\t\treturn this.__objProp.tcMar;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.width = function(width,unitType)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(width))\r\n\t\t{\r\n\t\t\tthis.__objProp.tcW = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:tcW\",\r\n\t\t\t\tattributes: {\"w:type\": unitType || \"\",\"w:w\": width}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this.__objProp.tcW;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.verticalAlign = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp.vAlign = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:vAlign\",\r\n\t\t\t\tattributes: {\"w:val\": value}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this.__objProp.vAlign;\r\n\t};\r\n\t\r\n\t//value can be continue,restart \r\n\tTableCellFormat.prototype.verticalMerge = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp.vMerge = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:vMerge\",\r\n\t\t\t\tattributes: {\"w:val\": value}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this.__objProp.vMerge;\r\n\t};\r\n\t\r\n\tTableCellFormat.prototype.toXml = function()\r\n\t{\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[key]))\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__objProp[key]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__noWrap)\r\n\t\t{\r\n\t\t\tthis.__children.push(\"<w:noWrap/>\");\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tcPr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableCellProperties-Margins.php\r\n\tvar TableCellMargins = function(docxRef,option)\r\n\t{\r\n\t\t//{val: null,sz: null,space: null,color: null}\r\n\t\t//this.__objProp = {top: null,start: null,bottom: null,end: null};\r\n\t\t//old doc version uses left and right rather than start and end\r\n\t\tthis.__objProp = {top: null,left: null,bottom: null,right: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(!this.top)\r\n\t\t{\r\n\t\t\toption = option || {};\r\n\t\t\tvar self = this;\r\n\t\t\tfor(var key in this.__objProp)\r\n\t\t\t{\r\n\t\t\t\titem = this.__objProp[key];\r\n\t\t\t\t(function(item,key)\r\n\t\t\t\t{\r\n\t\t\t\t\tself[key] = function(width,type)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn self.__setProp(key,width,type);\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(option[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar paramItem = option[key];\r\n\t\t\t\t\t\tself[key](paramItem.width,paramItem.type);\r\n\t\t\t\t\t}\r\n\t\t\t\t})(item,key)\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableCellMargins);\r\n\tTableCellMargins.prototype.constructor = TableCellMargins;\r\n\tNSDocxExport.prototype.TableCellMargins = TableCellMargins;\r\n\t\r\n\tTableCellMargins.prototype.setAll = function(color,width,type) \r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis[key](width,type);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tTableCellMargins.prototype.__setProp = function(key,width,type)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(width))\r\n\t\t{\r\n\t\t\tvar item = {w: width,type: type || \"dxa\"};\r\n\t\t\tthis.__objProp[key] = item;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tTableCellMargins.prototype.__xmlProp = function(key,item)\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in item)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(item[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = item[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:\" + key,\r\n\t\t\tattributes: attributes,\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tTableCellMargins.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__xmlProp(key,item));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tcMar\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t\r\n\t//http://officeopenxml.com/WPtableRow.php\r\n\tvar TableRow = function(docxRef)\r\n\t{\r\n\t\tthis.__rowProp = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableRow);\r\n\tTableRow.prototype.constructor = TableRow;\r\n\tNSDocxExport.prototype.TableRow = TableRow;\r\n\t\r\n\tTableRow.prototype.format = function(value)\r\n\t{\r\n\t\t/*if(value && value instanceof TableRowFormat) \r\n\t\t{\r\n\t\t\tthis.__rowProp = value\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__rowProp && (this.__rowProp = new TableRowFormat(this.__docxRef));\r\n\t\t}\r\n\t\treturn this.__rowProp;*/\r\n\t};\r\n\t\r\n\tTableRow.prototype.addCell = function()\r\n\t{\r\n\t\t var cell = new TableCell(this.__docxRef);\r\n\t\t this.__children.push(cell);\r\n\t\t return cell;\r\n\t};\r\n\t\r\n\tTableRow.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__rowProp)\r\n\t\t{\r\n\t\t\tthis.__children.unshift(this.__rowProp);\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableGrid.php\r\n\tvar TableGrid = function(docxRef)\r\n\t{\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableGrid);\r\n\tTableGrid.prototype.constructor = TableGrid;\r\n\tNSDocxExport.prototype.TableGrid = TableGrid;\r\n\t\r\n\tTableGrid.prototype.addColumn = function(value)\r\n\t{\r\n\t\t var column = new TableGridColumn(this.__docxRef);\r\n\t\t this.__children.push(column);\r\n\t\t return column;\r\n\t};\r\n\t\r\n\tTableGrid.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblGrid\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableGrid.php\r\n\tvar TableGridColumn = function(docxRef,width)\r\n\t{\r\n\t\tthis.__objAttr = {w: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(width) && this.width(width);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableGridColumn);\r\n\tTableGridColumn.prototype.constructor = TableGridColumn;\r\n\tNSDocxExport.prototype.TableGridColumn = TableGridColumn;\r\n\t\r\n\tTableGridColumn.prototype.width = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"w\",value);\r\n\t};\r\n\t\r\n\tTableGridColumn.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tTableGridColumn.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:gridCol\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableProperties.php\r\n\tvar TableFormat = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {jc:{value: null,method:\"alignment\",className: \"TableAlignment\"},\r\n\t\t\t\t\t\t  shd:{value: null,method:\"shading\",className: \"Shading\"},\r\n\t\t\t\t\t\t  tblBorders:{value: null,method:\"borders\",className: \"TableBorders\"},\r\n\t\t\t\t\t\t  //tblCaption:{value: null,method:\"caption\",className: \"TableCaption\"},\r\n\t\t\t\t\t\t  tblCellMar:{value: null,method:\"cellMargin\",className: \"TableCellMarginsDefault\"},\r\n\t\t\t\t\t\t  //tblCellSpacing:{value: null,method:\"cellSpacing\",className: \"TableCellSpacing\"},\r\n\t\t\t\t\t\t  //tblInd:{value: null,method:\"indent\",className: \"TableIndent\"},\r\n\t\t\t\t\t\t  tblLayout:{value: null,method:\"layout\",className: \"TableLayout\"},\r\n\t\t\t\t\t\t  //tblLook:{value: null,method:\"look\",className: \"TableLook\"},\r\n\t\t\t\t\t\t  //tblOverlap:{value: null,method:\"overlap\",className: \"TableOverlap\"},\r\n\t\t\t\t\t\t  //tblpPr:{value: null,method:\"ppr\",className: \"TablePPr\"},\r\n\t\t\t\t\t\t  //tblStyle:{value: null,method:\"style\",className: \"TableStyle\"},\r\n\t\t\t\t\t\t  //tblStyleColBandSize:{value: null,method:\"styleColBandSize\",className: \"TableStyleColBandSize\"},\r\n\t\t\t\t\t\t  //tblStyleRowBandSize:{value: null,method:\"styleRowBandSize\",className: \"TableStyleRowBandSize\"},\r\n\t\t\t\t\t\t  tblW:{value: null,method:\"width\",className: \"TableWidth\"},\r\n\t\t\t\t\t\t  tblStyle:{value: null, method: \"styleID\"},\r\n\t\t\t\t\t\t };\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addFunctions(this,\"__objProp\",option,null,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableFormat);\r\n\tTableFormat.prototype.constructor = TableFormat;\r\n\tNSDocxExport.prototype.TableFormat = TableFormat;\r\n\t\r\n\tTableFormat.prototype.setProperties = function(option)\r\n\t{\r\n\t\toption = option || {};\r\n\t\tif(option.alignment) \r\n\t\t{\r\n            this.alignment(option.alignment);\r\n        }\r\n\t\tif(option.shading) \r\n\t\t{\r\n            this.shading(option.shading);\r\n        }\r\n\t\tif(option.borders) \r\n\t\t{\r\n            this.borders(option.borders);\r\n        }\r\n\t\tif(option.cellMargin)\r\n\t\t{\r\n\t\t\tthis.cellMargin(option.cellMargin);\r\n\t\t}\r\n        if(option.layout) \r\n        {\r\n            this.layout(option.layout);\r\n        }\r\n        if(option.width) \r\n        {\r\n        \tthis.width(option.width);\r\n        }\r\n        else \r\n        {\r\n            this.width(100);\r\n        }\r\n        if (option.styleID) \r\n        {\r\n            this.styleID(option.styleID);\r\n        }\r\n\t};\r\n\t\r\n\tTableFormat.prototype.styleID = function(value)\r\n\t{\r\n\t\tif(value)\r\n\t\t{\r\n\t\t\tthis.__objProp.tblStyle.value = \"<w:tblStyle w:val=\\\"\" + value + \"\\\"/>\"\r\n\t\t}\r\n\t\treturn this.__objProp.tblStyle.value;\r\n\t};\r\n\t\r\n\tTableFormat.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[paramKey]\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tif(item)\r\n\t\t\t\tthis.__children.push(item.value);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblPr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableAlignment.php\r\n\tvar TableAlignment = function(docxRef,value)\r\n\t{\r\n\t\tthis.__value = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.value(value);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableAlignment);\r\n\tTableAlignment.prototype.constructor = TableAlignment;\r\n\tNSDocxExport.prototype.TableAlignment = TableAlignment;\r\n\t\r\n\tTableAlignment.prototype.value = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__value = value;\r\n\t\t}\r\n\t\treturn this.__value;\r\n\t};\r\n\t\r\n\tTableAlignment.prototype.toXml = function()\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(this.__value))\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblPr\",{\"w:val\": this.__value});\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableBorders.php\r\n\tvar TableBorders = function(docxRef,option)\r\n\t{\r\n\t\t//some older versions of word still uses left and right rather than start and end \r\n\t\t//this.__objProp = {top: null,start: null,bottom: null,end: null,insideH: null,insideV: null};\r\n\t\tthis.__objProp = {top: null,left: null,bottom: null,right: null,insideH: null,insideV: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(!this.top)\r\n\t\t{\r\n\t\t\toption = option || {};\r\n\t\t\tvar self = this;\r\n\t\t\tfor(var key in this.__objProp)\r\n\t\t\t{\r\n\t\t\t\titem = this.__objProp[key];\r\n\t\t\t\t(function(item,key)\r\n\t\t\t\t{\r\n\t\t\t\t\tself[key] = function(color,shadow,space,size,value)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn self.__setProp(key,color,shadow,space,size,value);\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(option[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar paramItem = option[key];\r\n\t\t\t\t\t\tself[key](paramItem.color,paramItem.shadow,paramItem.space,paramItem.size,paramItem.value);\r\n\t\t\t\t\t}\r\n\t\t\t\t})(item,key)\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.setDefault();\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableBorders);\r\n\tTableBorders.prototype.constructor = TableBorders;\r\n\tNSDocxExport.prototype.TableBorders = TableBorders;\r\n\t\r\n\tTableBorders.prototype.setDefault = function(color,shadow,space,size,value) \r\n\t{\r\n\t\tthis.setAll();\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.__objProp[key])\r\n\t\t\t{\r\n\t\t\t\tthis[key](\"auto\",null,0,4,\"single\");\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tTableBorders.prototype.setOutside = function(color,shadow,space,size,value) \r\n\t{\r\n\t    this.top(color,shadow,space,size,value);\r\n\t    this.left(color,shadow,space,size,value);\r\n\t    //this.start(color,shadow,space,size,value);\r\n\t    //this.end(color,shadow,space,size,value);\r\n\t    this.right(color,shadow,space,size,value);\r\n\t    this.bottom(color,shadow,space,size,value);\r\n\t};\r\n\r\n\tTableBorders.prototype.setInside = function(color,shadow,space,size,value) \r\n\t{\r\n\t    this.insideH(color,shadow,space,size,value);\r\n\t    this.insideV(color,shadow,space,size,value);\r\n\t};\r\n\r\n\tTableBorders.prototype.setAll = function(color,shadow,space,size,value) \r\n\t{\r\n\t\tthis.setInside(color,shadow,space,size,value);\r\n\t    this.setOutside(color,shadow,space,size,value);\r\n\t};\r\n\t\r\n\tTableBorders.prototype.__setProp = function(key,color,shadow,space,size,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(color) || !this.util.isUndefinedOrNull(shadow) || !this.util.isUndefinedOrNull(space) || !this.util.isUndefinedOrNull(size) || !this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tvar item = {color: color,shadow: shadow,space: space,sz: size,val: value};\r\n\t\t\tthis.__objProp[key] = item;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tTableBorders.prototype.__xmlProp = function(key,item)\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in item)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(item[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = item[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:\" + key,\r\n\t\t\tattributes: attributes,\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tTableBorders.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__xmlProp(key,item));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblBorders\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableCellMargins.php\r\n\tvar TableCellMarginsDefault = function(docxRef,option)\r\n\t{\r\n\t\t//this.__objProp = {top: null,start: null,bottom: null,end: null};\r\n\t\t//old doc version uses left and right rather than start and end\r\n\t\tthis.__objProp = {top: null,left: null,bottom: null,right: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(!this.top)\r\n\t\t{\r\n\t\t\toption = option || {};\r\n\t\t\tvar self = this;\r\n\t\t\tfor(var key in this.__objProp)\r\n\t\t\t{\r\n\t\t\t\titem = this.__objProp[key];\r\n\t\t\t\t(function(item,key)\r\n\t\t\t\t{\r\n\t\t\t\t\tself[key] = function(width,type)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn self.__setProp(key,width,type);\r\n\t\t\t\t\t};\r\n\t\t\t\t\tif(option[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar paramItem = option[key];\r\n\t\t\t\t\t\tself[key](paramItem.width,paramItem.type);\r\n\t\t\t\t\t}\r\n\t\t\t\t})(item,key)\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableCellMarginsDefault);\r\n\tTableCellMarginsDefault.prototype.constructor = TableCellMarginsDefault;\r\n\tNSDocxExport.prototype.TableCellMarginsDefault = TableCellMarginsDefault;\r\n\t\r\n\tTableCellMarginsDefault.prototype.setAll = function(color,width,type) \r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis[key](width,type);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tTableCellMarginsDefault.prototype.__setProp = function(key,width,type)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(width))\r\n\t\t{\r\n\t\t\tvar item = {w: width,type: type || \"dxa\"};\r\n\t\t\tthis.__objProp[key] = item;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tTableCellMarginsDefault.prototype.__xmlProp = function(key,item)\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in item)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(item[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = item[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:\" + key,\r\n\t\t\tattributes: attributes,\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tTableCellMarginsDefault.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__xmlProp(key,item));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblCellMar\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableCellMargins.php\r\n\tvar TableLayout = function(docxRef,type)\r\n\t{\r\n\t\tthis.__type = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableLayout);\r\n\tTableLayout.prototype.constructor = TableLayout;\r\n\tNSDocxExport.prototype.TableLayout = TableLayout;\r\n\t\r\n\tTableLayout.prototype.type = function(type)\r\n\t{\r\n\t\tthis.__type = type;\r\n\t};\r\n\t\r\n\tTableLayout.prototype.toXml = function()\r\n\t{\r\n\t\tif(this.__type && this.__type.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblLayout\",{\"w:type\": this.__type});\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtableWidth.php\r\n\tvar TableWidth = function(docxRef,width,type)\r\n\t{\r\n\t\tthis.__objAttr = {type: null,w: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tvar option = this.util.isObject(width) ? width : {type: type,width: width};\r\n\t\tthis.type(option.type || \"auto\");\r\n\t\t!this.util.isUndefinedOrNull(option.width) && this.width(option.width);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,TableWidth);\r\n\tTableWidth.prototype.constructor = TableWidth;\r\n\tNSDocxExport.prototype.TableWidth = TableWidth;\r\n\t\r\n\tTableWidth.prototype.type = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"type\",value);\r\n\t};\r\n\t\r\n\tTableWidth.prototype.width = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"w\",value);\r\n\t};\r\n\t\r\n\tTableWidth.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tTableWidth.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:tblW\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsection.php\r\n\tvar Section = function(docxRef,option)\r\n\t{\r\n\t\t//cols,lnNumType,pgBorders,pgMar,pgNumType,pgSz,type\r\n\t\tthis.__objProp = {cols:{value: null,method:\"cols\",className: \"SectionColumns\"},\r\n\t\t\t\t\t\t  lnNumType:{value: null,method:\"lnNumType\",className: \"LineNumbers\"},\r\n\t\t\t\t\t\t  pgBorders:{value: null,method:\"pgBorders\",className: \"SectionBorder\"},\r\n\t\t\t\t\t\t  pgMar:{value: null,method:\"pgMar\",className: \"PageMargins\"},\r\n\t\t\t\t\t\t  pgNumType:{value: null,method:\"pgNumType\",className: \"PageNumbers\"},\r\n\t\t\t\t\t\t  pgSz:{value: null,method:\"pgSz\",className: \"PageSize\"},\r\n\t\t\t\t\t\t  type:{value: null,method:\"type\",className: \"SectionType\"},\r\n\t\t\t\t\t\t  vAlign:{value: null,method:\"type\",className: \"SectionVAlign\"},\r\n\t\t\t\t\t\t };\r\n\t\tthis.__default = {header: null,footer: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addFunctions(this,\"__objProp\",option,null,docxRef);\r\n\t\tthis.__setDefaultValues();\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Section);\r\n\tSection.prototype.constructor = Section;\r\n\tNSDocxExport.prototype.Section = Section;\r\n\t\r\n\tSection.prototype.__setDefaultValues = function()\r\n\t{\r\n\t\tif(!this.__objProp.cols.value)\r\n\t\t{\r\n\t\t\tvar cols = this.cols();\r\n\t\t\tcols.num(1);\r\n\t\t\tcols.space(708);\r\n\t\t}\r\n\t\t/*if(!this.__objProp.pgNumType.value)\r\n\t\t{\r\n\t\t\tvar pgNumType = this.pgNumType();\r\n\t\t\tpgNumType.fmt(\"decimal\");\r\n\t\t\tpgNumType.start(1);\r\n\t\t}*/\r\n\t};\r\n\t\r\n\tSection.prototype.addHeader = function(type)\r\n\t{\r\n\t\tvar header = new Header(this.__docxRef);\r\n\t\tvar refID = header.getRefID();\r\n\t    if((!type || type.toLowerCase() == \"default\") && this.__setDefault(\"header\",header))\r\n\t    {\r\n\t    \ttype = \"default\";\r\n\t    }\r\n\t    this.__children.push(\"<w:headerReference w:type=\\\"\" + type + \"\\\" r:id=\\\"\" + refID + \"\\\"/>\");\r\n\t    return header;\r\n\t};\r\n\t\r\n\tSection.prototype.addFooter = function(type)\r\n\t{\r\n\t\tvar footer = new Footer(this.__docxRef);\r\n\t    var refID = footer.getRefID();\r\n\t    if((!type || type.toLowerCase() == \"default\") && this.__setDefault(\"footer\",footer))\r\n\t    {\r\n\t    \ttype = \"default\";\r\n\t    }\r\n\t    this.__children.push(\"<w:footerReference w:type=\\\"\" + type + \"\\\" r:id=\\\"\" + refID + \"\\\"/>\");\r\n\t    return footer;\r\n\t};\r\n\t\r\n\tSection.prototype.addParagraph = function(option)\r\n\t{\r\n\t\tvar paragraph = new Paragraph(this.__docxRef,option);\r\n\t    this.__children.push(paragraph);\r\n\t    return paragraph;\r\n\t};\r\n\t\r\n\tSection.prototype.addTable = function(option)\r\n\t{\r\n\t\tvar table = new Table(this.__docxRef,option);\r\n\t    this.__children.push(table);\r\n\t    return table;\r\n\t};\r\n\t\r\n\tSection.prototype.__setDefault = function(key,value)\r\n\t{\r\n\t\tif(key && value && !this.__default[key])\r\n\t\t{\r\n\t\t\tthis.__default[key] = value;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t};\r\n\t\r\n\tSection.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[paramKey]\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(item.value);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:sectPr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsection.php (in Elements section)\r\n\tvar SectionType = function(docxRef,value)\r\n\t{\r\n\t\tthis.__objAttr = {val: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(value) && this.value(value);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,SectionType);\r\n\tSectionType.prototype.constructor = SectionType;\r\n\tNSDocxExport.prototype.SectionType = SectionType;\r\n\t\r\n\tSectionType.prototype.value = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"val\",value);\r\n\t};\r\n\t\r\n\tSectionType.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tSectionType.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:type\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsection.php (in Elements section)\r\n\tvar SectionVAlign = function(docxRef,value)\r\n\t{\r\n\t\tthis.__objAttr = {val: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(value) && this.value(value);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,SectionVAlign);\r\n\tSectionVAlign.prototype.constructor = SectionVAlign;\r\n\tNSDocxExport.prototype.SectionVAlign = SectionVAlign;\r\n\t\r\n\tSectionVAlign.prototype.value = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"val\",value);\r\n\t};\r\n\t\r\n\tSectionVAlign.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tSectionVAlign.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:vAlign\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsectionCols.php\r\n\tvar SectionColumns = function(docxRef,equalWidth,num,sep,space)\r\n\t{\r\n\t\tthis.__objProp = {equalWidth: null,num: null,sep: null,space: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(equalWidth) && this.equalWidth(equalWidth);\r\n\t\t!this.util.isUndefinedOrNull(num) && this.num(num);\r\n\t\t!this.util.isUndefinedOrNull(sep) && this.sep(sep);\r\n\t\t!this.util.isUndefinedOrNull(space) && this.space(space);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,SectionColumns);\r\n\tSectionColumns.prototype.constructor = SectionColumns;\r\n\tNSDocxExport.prototype.SectionColumns = SectionColumns;\r\n\t\r\n\tSectionColumns.prototype.equalWidth = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"equalWidth\",value);\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.num = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"num\",value);\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.sep = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"sep\",value);\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.space = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"space\",value);\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.addColumn = function(width,space)\r\n\t{\r\n\t\tvar item = null;\r\n\t\tif(!this.util.isUndefinedOrNull(width))\r\n\t\t{\r\n\t\t\titem = {width: width,space: space};\r\n\t\t\tthis.__children.push(item);\r\n\t\t}\r\n\t\treturn item;\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp[key] = value;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tSectionColumns.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = this.__objProp[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar arrChildren = [];\r\n\t\tvar item = null;\r\n\t\tvar attributesChild = {}\r\n\t\tvar xmlChild = null;\r\n\t\tfor(var count = 0;count < this.__children.length;count++)\r\n\t\t{\r\n\t\t\titem = this.__children[count];\r\n\t\t\tif(item && !this.util.isUndefinedOrNull(item.width))\r\n\t\t\t{\r\n\t\t\t\tattributesChild = {\"w:w\": item.width};\r\n\t\t\t\tif(!this.util.isUndefinedOrNull(item.space))\r\n\t\t\t\t{\r\n\t\t\t\t\tattributesChild[\"w:space\"] = item.space;\r\n\t\t\t\t}\r\n\t\t\t\txmlChild = this.__exportUtil.getXML({\r\n\t\t\t\t\tname: \"w:col\",\r\n\t\t\t\t\tattributes: attributesChild,\r\n\t\t\t\t});\r\n\t\t\t\tarrChildren.push(xmlChild);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(attributes).length || arrChildren.length)\r\n\t\t{\r\n\t\t\titem = {name: \"w:cols\"};\r\n\t\t\tif(Object.keys(attributes).length)\r\n\t\t\t{\r\n\t\t\t\titem[\"attributes\"] = attributes;\r\n\t\t\t}\r\n\t\t\tif(arrChildren.length)\r\n\t\t\t{\r\n\t\t\t\titem[\"children\"] = arrChildren;\r\n\t\t\t}\r\n\t\t\txml = this.__exportUtil.getXML(item);\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsectionBorders.php\r\n\tvar SectionBorder = function(docxRef)\r\n\t{\r\n\t\t//{val: null,sz: null,space: null,color: null}\r\n\t\tthis.__objProp = {top: null,bottom: null,left: null,right: null};\r\n\t\tthis.__objAttr = {display: null,offsetFrom: null,zOrder: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,SectionBorder);\r\n\tSectionBorder.prototype.constructor = SectionBorder;\r\n\tNSDocxExport.prototype.SectionBorder = SectionBorder;\r\n\t\r\n\tSectionBorder.prototype.display = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"display\",value);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.offsetFrom = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"offsetFrom\",value);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.zOrder = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"zOrder\",value);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.top = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"top\",option);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.bottom = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"bottom\",option);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.left = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"left\",option);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.right = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"right\",option);\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.__setProp = function(key,option)\r\n\t{\r\n\t\toption = option || {};\r\n\t\tif(!this.util.isUndefinedOrNull(option.value) || !this.util.isUndefinedOrNull(option.size) || !this.util.isUndefinedOrNull(option.space) || !this.util.isUndefinedOrNull(option.color))\r\n\t\t{\r\n\t\t\tvar item = {val: option.value,sz: option.size,space: option.space,color: option.color};\r\n\t\t\tthis.__objProp[key] = item;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.__xmlProp = function(key,item)\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in item)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(item[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = item[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:\" + key,\r\n\t\t\tattributes: attributes,\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tSectionBorder.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__xmlProp(key,item));\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:pgBorders\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPSectionPgMar.php\r\n\tvar PageMargins = function(docxRef,header,bottom,top,right,left,footer,gutter)\r\n\t{\r\n\t\tthis.__objAttr = {header: null,bottom: null,top: null,right: null,left: null,footer: null,gutter: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(header) && this.header(header);\r\n\t\t!this.util.isUndefinedOrNull(bottom) && this.bottom(bottom);\r\n\t\t!this.util.isUndefinedOrNull(top) && this.top(top);\r\n\t\t!this.util.isUndefinedOrNull(right) && this.right(right);\r\n\t\t!this.util.isUndefinedOrNull(left) && this.left(left);\r\n\t\t!this.util.isUndefinedOrNull(footer) && this.footer(footer);\r\n\t\t!this.util.isUndefinedOrNull(gutter) && this.gutter(gutter);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,PageMargins);\r\n\tPageMargins.prototype.constructor = PageMargins;\r\n\tNSDocxExport.prototype.PageMargins = PageMargins;\r\n\t\r\n\tPageMargins.prototype.header = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"header\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.bottom = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"bottom\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.top = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"top\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.right = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"right\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.left = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"left\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.footer = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"footer\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.gutter = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"gutter\",value);\r\n\t};\r\n\t\r\n\tPageMargins.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tPageMargins.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:pgMar\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsection.php (in Elements section)\r\n\tvar PageSize = function(docxRef,height,width,orientation)\r\n\t{\r\n\t\tthis.__objAttr = {h: null,w: null,orient: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(height) && this.height(height);\r\n\t\t!this.util.isUndefinedOrNull(width) && this.width(width);\r\n\t\t!this.util.isUndefinedOrNull(orientation) && this.orientation(orientation);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,PageSize);\r\n\tPageSize.prototype.constructor = PageSize;\r\n\tNSDocxExport.prototype.PageSize = PageSize;\r\n\t\r\n\tPageSize.prototype.height = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"h\",value);\r\n\t};\r\n\t\r\n\tPageSize.prototype.width = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"w\",value);\r\n\t};\r\n\t\r\n\tPageSize.prototype.orientation = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"orient\",value);\r\n\t};\r\n\t\r\n\tPageSize.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tPageSize.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:pgSz\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPSectionPgNumType.php\r\n\tvar PageNumbers = function(docxRef,chapSep,chapStyle,fmt,start)\r\n\t{\r\n\t\tthis.__objAttr = {chapSep: null,chapStyle: null,fmt: null,start: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(chapSep) && this.chapSep(chapSep);\r\n\t\t!this.util.isUndefinedOrNull(chapStyle) && this.chapStyle(chapStyle);\r\n\t\t!this.util.isUndefinedOrNull(fmt) && this.fmt(fmt);\r\n\t\t!this.util.isUndefinedOrNull(start) && this.start(start);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,PageNumbers);\r\n\tPageNumbers.prototype.constructor = PageNumbers;\r\n\tNSDocxExport.prototype.PageNumbers = PageNumbers;\r\n\t\r\n\tPageNumbers.prototype.chapSep = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"chapSep\",value);\r\n\t};\r\n\t\r\n\tPageNumbers.prototype.chapStyle = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"chapStyle\",value);\r\n\t};\r\n\t\r\n\tPageNumbers.prototype.fmt = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"fmt\",value);\r\n\t};\r\n\t\r\n\tPageNumbers.prototype.start = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"start\",value);\r\n\t};\r\n\t\r\n\tPageNumbers.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tPageNumbers.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:pgNumType\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPsectionLineNumbering.php\r\n\tvar LineNumbers = function(docxRef,countBy,distance,restart,start)\r\n\t{\r\n\t\tthis.__objAttr = {countBy: null,distance: null,restart: null,start: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\t!this.util.isUndefinedOrNull(countBy) && this.countBy(countBy);\r\n\t\t!this.util.isUndefinedOrNull(distance) && this.distance(distance);\r\n\t\t!this.util.isUndefinedOrNull(restart) && this.restart(restart);\r\n\t\t!this.util.isUndefinedOrNull(start) && this.start(start);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,LineNumbers);\r\n\tLineNumbers.prototype.constructor = LineNumbers;\r\n\tNSDocxExport.prototype.LineNumbers = LineNumbers;\r\n\t\r\n\tLineNumbers.prototype.countBy = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"countBy\",value);\r\n\t};\r\n\t\r\n\tLineNumbers.prototype.distance = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"distance\",value);\r\n\t};\r\n\t\r\n\tLineNumbers.prototype.restart = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"restart\",value);\r\n\t};\r\n\t\r\n\tLineNumbers.prototype.start = function(value)\r\n\t{\r\n\t\treturn this.__setAttr(\"start\",value);\r\n\t};\r\n\t\r\n\tLineNumbers.prototype.__setAttr = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objAttr[key] = value;\r\n\t\t}\r\n\t\treturn this.__objAttr[key];\r\n\t};\r\n\t\r\n\tLineNumbers.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar key = null;\r\n\t\tvar attributes = {};\r\n\t\tfor(key in this.__objAttr)\r\n\t\t{\r\n\t\t\titem = this.__objAttr[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(attributes && Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:lnNumType\",attributes);\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPcontentOverview.php\r\n\tvar Paragraph = function(docxRef,option)\r\n\t{\r\n\t\tthis.__format = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Paragraph);\r\n\tParagraph.prototype.constructor = Paragraph;\r\n\tNSDocxExport.prototype.Paragraph = Paragraph;\r\n\t\r\n\tParagraph.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(option.text)\r\n\t\t\t{\r\n\t\t\t\tvar run = this.addText(option.text);\r\n\t\t\t}\r\n\t\t\tif(option.pageBreak)\r\n\t\t\t{\r\n\t\t\t\tthis.addPageBreak();\r\n\t\t\t}\r\n\t\t\tthis.format(option);\r\n\t\t}\r\n\t};\r\n\t\r\n\tParagraph.prototype.format = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphFormat)\r\n\t\t{\r\n\t\t\tthis.__format = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__format && (this.__format = new ParagraphFormat(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__format;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addRun = function(value)\r\n\t{\r\n\t\tvar run = new Run(this.__docxRef,value);\r\n\t    this.__children.push(run);\r\n\t    return run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addText = function(text)\r\n\t{\r\n\t\tvar run = this.addRun();\r\n\t\trun.addText(text);\r\n\t    return run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addCurrentPageNumber = function()\r\n\t{\r\n\t\tvar format = this.format();\r\n\t\tif(!format.horizontalAlignment().value())\r\n\t\t{\r\n\t\t\tformat.horizontalAlignment().value(\"center\");\r\n\t\t}\r\n\t\tvar run = this.__addSpecialString(\"PAGE\");\r\n\t\treturn run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addTotalPageNumber = function()\r\n\t{\r\n\t\tvar format = this.format();\r\n\t\tif(!format.horizontalAlignment().value())\r\n\t\t{\r\n\t\t\tformat.horizontalAlignment().value(\"center\");\r\n\t\t}\r\n\t\tvar run = this.__addSpecialString(\"NUMPAGES\");\r\n\t\treturn run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addTotalPageNumberInSection = function()\r\n\t{\r\n\t\tvar format = this.format();\r\n\t\tif(!format.horizontalAlignment().value())\r\n\t\t{\r\n\t\t\tformat.horizontalAlignment().value(\"center\");\r\n\t\t}\r\n\t\tvar run = this.__addSpecialString(\"SECTIONPAGES\");\r\n\t\treturn run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.addPageBreak = function()\r\n\t{\r\n\t\tvar run = this.addRun();\r\n\t\trun.addBreak(\"page\");\r\n\t    return run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.__addSpecialString = function(str)\r\n\t{\r\n\t\tvar run = this.addRun();\r\n\t\trun.addFldChar(\"begin\");\r\n\t\trun.addInstrText(str);\r\n\t\trun.addFldChar(\"separate\");\r\n\t\trun.addFldChar(\"end\");\r\n\t\treturn run;\r\n\t};\r\n\t\r\n\tParagraph.prototype.toXml = function()\r\n\t{\r\n\t\t//format should be at start\r\n\t\tif(this.__format)\r\n\t\t{\r\n\t\t\tthis.__children.unshift(this.__format);\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:p\");\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPparagraphProperties.php\r\n\t//option value can have horizontalAlignment,borders,indentation,shading,spacing,tabs,verticalAlignment,keepNext,keepLines\r\n\tvar ParagraphFormat = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {horizontalAlignment:{variable: \"__hAlignment\", method: \"horizontalAlignment\"},\r\n\t\t\t\t\t\t  borders:{variable: \"__borders\", method: \"borders\"},\r\n\t\t\t\t\t\t  indentation:{variable: \"__indentation\", method: \"indentation\"},\r\n\t\t\t\t\t\t  shading:{variable: \"__shading\", method: \"shading\"},\r\n\t\t\t\t\t\t  spacing:{variable: \"__spacing\", method: \"spacing\"},\r\n\t\t\t\t\t\t  contextualSpacing:{variable: \"__contextualSpacing\", method: \"contextualSpacing\",tag:\"w:contextualSpacing\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  tabs:{variable: \"__tabs\", method: \"tabs\"},\r\n\t\t\t\t\t\t  verticalAlignment:{variable: \"__vAlignment\", method: \"verticalAlignment\"},\r\n\t\t\t\t\t\t  keepNext:{variable: \"__keepNext\", method: \"keepNext\", tag: \"w:keepNext\"},\r\n\t\t\t\t\t\t  keepLines:{variable: \"__keepLines\", method: \"keepLines\", tag: \"w:keepLines\"},\r\n\t\t\t\t\t\t  outlineLevel:{variable: \"__outlineLevel\", method: \"outlineLevel\",tag:\"w:outlineLvl\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  styleID:{variable: \"__styleID\", method: \"styleID\",tag:\"w:pStyle\",attr:\"w:val\"},\r\n\t\t\t\t\t\t  numberingProperties:{variable: \"__numberingProperties\", method: \"numberingProperties\"}\r\n\t\t\t\t\t\t };\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphFormat);\r\n\tParagraphFormat.prototype.constructor = ParagraphFormat;\r\n\tNSDocxExport.prototype.ParagraphFormat = ParagraphFormat;\r\n\t\r\n\tParagraphFormat.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif (option.horizontalAlign) \r\n\t\t\t{\r\n                this.horizontalAlignment(option.horizontalAlign);\r\n            }\r\n\t\t\tif(option.borders) \r\n            {\r\n\t\t\t\tthis.borders(option.borders)\r\n            }\r\n\t\t\telse if (option.horizontalLine) \r\n            {\r\n                this.horizontalLine();\r\n            }\r\n            if (option.contextualSpacing) \r\n            {\r\n                this.contextualSpacing(option.contextualSpacing);\r\n            }\r\n            if (option.rightTab) \r\n            {\r\n            \tvar tabs = this.tabs();\r\n            \ttabs.addTab({val: \"right\",pos: option.rightTab});\r\n            }\r\n            if (option.leftTab) \r\n            {\r\n            \tvar tabs = this.tabs();\r\n            \ttabs.addTab({val: \"left\",pos: option.leftTab});\r\n            }\r\n            if (option.indent) \r\n            {\r\n                this.indentation(option.indent);\r\n            }\r\n            if (option.spacing) \r\n            {\r\n                this.spacing(option.spacing);\r\n            }\r\n            if (option.keepNext) \r\n            {\r\n                this.keepNext(true);\r\n            }\r\n            if (option.keepLines) \r\n            {\r\n            \tthis.keepLines(true);\r\n            }\r\n            if (option.outlineLevel) \r\n            {\r\n                this.outlineLevel(option.outlineLevel);\r\n            }\r\n            if (option.styleID) \r\n            {\r\n                this.styleID(option.styleID);\r\n            }\r\n            if (option.numberingProperties) \r\n            {\r\n            \tthis.numberingProperties(option.numberingProperties);\r\n            }\r\n\t\t}\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.horizontalAlignment = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphHAlignment)\r\n\t\t{\r\n\t\t\tthis.__hAlignment = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__hAlignment && (this.__hAlignment = new ParagraphHAlignment(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__hAlignment;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.horizontalLine = function()\r\n\t{\r\n\t\tvar border = this.borders({bottom: {color: \"auto\",space: 1,value: \"single\",size: 6}});\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.borders = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphBorder)\r\n\t\t{\r\n\t\t\tthis.__borders = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__borders && (this.__borders = new ParagraphBorder(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__borders;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.indentation = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphIndentation)\r\n\t\t{\r\n\t\t\tthis.__indentation = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__indentation && (this.__indentation = new ParagraphIndentation(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__indentation;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.shading = function(value)\r\n\t{\r\n\t\tif(value && value instanceof Shading)\r\n\t\t{\r\n\t\t\tthis.__shading = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__shading && (this.__shading = new Shading(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__shading;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.spacing = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphSpacing)\r\n\t\t{\r\n\t\t\tthis.__spacing = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__spacing && (this.__spacing = new ParagraphSpacing(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__spacing;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.contextualSpacing = function(value)\r\n\t{\r\n\t\tthis.__contextualSpacing = (value === false) ? 0 : 1;\r\n\t\treturn this.__contextualSpacing;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.tabs = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphTabs)\r\n\t\t{\r\n\t\t\tthis.__tabs = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__tabs && (this.__tabs = new ParagraphTabs(this.__docxRef));\r\n\t\t}\r\n\t\treturn this.__tabs;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.verticalAlignment = function(value)\r\n\t{\r\n\t\tif(value && value instanceof ParagraphVAlignment)\r\n\t\t{\r\n\t\t\tthis.__vAlignment = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__vAlignment = new ParagraphVAlignment(this.__docxRef);\r\n\t\t}\r\n\t\treturn this.__vAlignment;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.keepNext = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__keepNext = value;\r\n\t\t}\r\n\t\treturn this.__keepNext;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.keepLines = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__keepLines = value;\r\n\t\t}\r\n\t\treturn this.__keepLines;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.outlineLevel = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__outlineLevel = value;\r\n\t\t}\r\n\t\treturn this.__outlineLevel;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.styleID = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__styleID = value;\r\n\t\t}\r\n\t\treturn this.__styleID;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.numberingProperties = function(value)\r\n\t{\r\n\t\tif(value && value instanceof NumberingProperties)\r\n\t\t{\r\n\t\t\tthis.__numberingProperties = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__numberingProperties && (this.__numberingProperties = new NumberingProperties(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__numberingProperties;\r\n\t};\r\n\t\r\n\tParagraphFormat.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar attr = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(this[item.variable]))\r\n\t\t\t{\r\n\t\t\t\tif(item.tag && !item.attr && this[item.variable])\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(\"<\" + item.tag + \"/>\");  \r\n\t\t\t\t}\r\n\t\t\t\telse if(item.tag && item.attr)\r\n\t\t\t\t{\r\n\t\t\t\t\tattr = {};\r\n\t\t\t\t\tattr[item.attr] = this[item.variable];\r\n\t\t\t\t\tthis.__children.push(this.__exportUtil.getXML({\r\n\t\t\t\t\t\tname: item.tag,\r\n\t\t\t\t\t\tattributes: attr,\r\n\t\t\t\t\t}));\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(this[item.variable]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:pPr\");\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tvar NumberingProperties = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {level: {value:null, method:\"level\",tag:\"w:ilvl\"},\r\n\t\t\t\t\t\t  numberID: {value:null, method:\"numberID\",tag:\"w:numId\"},\r\n\t\t};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.__exportUtil.addSingleValueFunctions(this,this.__objProp,null,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t\t\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,NumberingProperties);\r\n\tNumberingProperties.prototype.constructor = NumberingProperties;\r\n\tNSDocxExport.prototype.NumberingProperties = NumberingProperties;\r\n\t\r\n\tNumberingProperties.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(option.level))\r\n\t\t\t{\r\n\t\t\t\tthis.level(option.level);\r\n\t\t\t}\r\n\t\t\tif(!this.util.isUndefinedOrNull(option.numberID))\r\n\t\t\t{\r\n\t\t\t\tthis.numberID(option.numberID);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNumberingProperties.prototype.toXml = function()\r\n\t{\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\tvar item = this.__objProp[key];\r\n\t\t\tif(!this.util.isUndefinedOrNull(item.value))\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__exportUtil.getValXml(item.value,item.tag));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length > 0)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:numPr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPalignment.php\r\n\tvar ParagraphHAlignment = function(docxRef,value)\r\n\t{\r\n\t\tthis.__value = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.value(value);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphHAlignment);\r\n\tParagraphHAlignment.prototype.constructor = ParagraphHAlignment;\r\n\tNSDocxExport.prototype.ParagraphHAlignment = ParagraphHAlignment;\r\n\t\r\n\tParagraphHAlignment.prototype.value = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__value = value;\r\n\t\t}\r\n\t\treturn this.__value;\r\n\t};\r\n\t\r\n\tParagraphHAlignment.prototype.toXml = function()\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(this.__value))\r\n\t\t{\r\n\t\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:jc\",\r\n\t\t\t\tattributes: {\"w:val\": this.__value},\r\n\t\t\t});\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\r\n\t//http://officeopenxml.com/WPborders.php\r\n\tvar ParagraphBorder = function(docxRef,option)\r\n\t{\r\n\t\t//{val: null,sz: null,space: null,color: null}\r\n\t\tthis.__objProp = {top: null,bottom: null,left: null,right: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tvar item = null;\r\n\t\t\tfor(var key in option)\r\n\t\t\t{\r\n\t\t\t\tif(this.__objProp.hasOwnProperty(key))\r\n\t\t\t\t{\r\n\t\t\t\t\titem = option[key];\r\n\t\t\t\t\tthis[this.__objProp[key]](item);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphBorder);\r\n\tParagraphBorder.prototype.constructor = ParagraphBorder;\r\n\tNSDocxExport.prototype.ParagraphBorder = ParagraphBorder;\r\n\t\r\n\t//value,size,space,color\r\n\tParagraphBorder.prototype.top = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"top\",option);\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.bottom = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"bottom\",option);\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.left = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"left\",option);\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.right = function(option)\r\n\t{\r\n\t\treturn this.__setProp(\"right\",option);\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.__setProp = function(key,option)\r\n\t{\r\n\t\toption = option || {};\r\n\t\tif(!this.util.isUndefinedOrNull(option.value) || !this.util.isUndefinedOrNull(option.size) || !this.util.isUndefinedOrNull(option.space) || !this.util.isUndefinedOrNull(option.color))\r\n\t\t{\r\n\t\t\tvar item = {val: option.value,sz: option.size,space: option.space,color: option.color};\r\n\t\t\tthis.__objProp[key] = item;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.__xmlProp = function(key,item)\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in item)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(item[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = item[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:\" + key,\r\n\t\t\tattributes: attributes,\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tParagraphBorder.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tfor(var key in this.__objProp)\r\n\t\t{\r\n\t\t\titem = this.__objProp[key];\r\n\t\t\tif(item)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(this.__xmlProp(key,item));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__children && this.__children.length)\r\n\t\t{\r\n\t\t\tvar xml = this.base.toXml.call(this,\"w:pBdr\");\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPindentation.php\r\n\tvar ParagraphIndentation = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {left: null,right: null,hanging: null,firstLine: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\t!this.util.isUndefinedOrNull(option.left) && this.left(option.left);\r\n\t\t\t!this.util.isUndefinedOrNull(option.right) && this.right(option.right);\r\n\t\t\t!this.util.isUndefinedOrNull(option.hanging) && this.hanging(option.hanging);\r\n\t\t\t!this.util.isUndefinedOrNull(option.firstLine) && this.firstLine(option.firstLine);\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphIndentation);\r\n\tParagraphIndentation.prototype.constructor = ParagraphIndentation;\r\n\tNSDocxExport.prototype.ParagraphIndentation = ParagraphIndentation;\r\n\t\r\n\tParagraphIndentation.prototype.left = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"left\",value);\r\n\t};\r\n\t\r\n\tParagraphIndentation.prototype.right = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"right\",value);\r\n\t};\r\n\t\r\n\tParagraphIndentation.prototype.hanging = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"hanging\",value);\r\n\t};\r\n\t\r\n\tParagraphIndentation.prototype.firstLine = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"firstLine\",value);\r\n\t};\r\n\t\r\n\tParagraphIndentation.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp[key] = value;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tParagraphIndentation.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = this.__objProp[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:ind\",\r\n\t\t\t\tattributes: attributes,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPshading.php\r\n\tvar Shading = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {fill: null,color: null,val: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\t!this.util.isUndefinedOrNull(option.fill) && this.fill(option.fill);\r\n\t\t\t!this.util.isUndefinedOrNull(option.color) && this.color(option.color);\r\n\t\t\t!this.util.isUndefinedOrNull(option.value) && this.val(option.value);\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Shading);\r\n\tShading.prototype.constructor = Shading;\r\n\tNSDocxExport.prototype.Shading = Shading;\r\n\t\r\n\tShading.prototype.fill = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"fill\",value);\r\n\t};\r\n\t\r\n\tShading.prototype.color = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"color\",value);\r\n\t};\r\n\t\r\n\tShading.prototype.val = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"val\",value);\r\n\t};\r\n\t\r\n\tShading.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp[key] = value;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tShading.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = this.__objProp[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:shd\",\r\n\t\t\t\tattributes: attributes,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPspacing.php\r\n\tvar ParagraphSpacing = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {after: null,before: null,line: null,lineRule: null,beforeAutospacing: null,afterAutospacing: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\t!this.util.isUndefinedOrNull(option.after) && this.after(option.after);\r\n\t\t\t!this.util.isUndefinedOrNull(option.before) && this.before(option.before);\r\n\t\t\t!this.util.isUndefinedOrNull(option.line) && this.line(option.line);\r\n\t\t\t!this.util.isUndefinedOrNull(option.lineRule) && this.lineRule(option.lineRule);\r\n\t\t\t!this.util.isUndefinedOrNull(option.beforeAutospacing) && this.beforeAutospacing(option.beforeAutospacing);\r\n\t\t\t!this.util.isUndefinedOrNull(option.afterAutospacing) && this.afterAutospacing(option.afterAutospacing);\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphSpacing);\r\n\tParagraphSpacing.prototype.constructor = ParagraphSpacing;\r\n\tNSDocxExport.prototype.ParagraphSpacing = ParagraphSpacing;\r\n\t\r\n\tParagraphSpacing.prototype.after = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"after\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.before = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"before\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.after = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"after\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.line = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"line\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.beforeAutospacing = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"beforeAutospacing\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.afterAutospacing = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"afterAutospacing\",value);\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp[key] = value;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tParagraphSpacing.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = this.__objProp[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:spacing\",\r\n\t\t\t\tattributes: attributes,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtab.php\r\n\tvar ParagraphTabs = function(docxRef,option)\r\n\t{\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphTabs);\r\n\tParagraphTabs.prototype.constructor = ParagraphTabs;\r\n\tNSDocxExport.prototype.ParagraphTabs = ParagraphTabs;\r\n\t\r\n\tParagraphTabs.prototype.addTab = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tvar tab = new ParagraphTab(this.__docxRef,option);\r\n\t\t    this.__children.push(tab);\r\n\t\t    return tab;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\tParagraphTabs.prototype.toXml = function()\r\n\t{\r\n\t\tvar xml = this.base.toXml.call(this,\"w:tabs\");\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtab.php\r\n\tvar ParagraphTab = function(docxRef,option)\r\n\t{\r\n\t\tthis.__objProp = {leader: null,pos: null,val: null};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\t!this.util.isUndefinedOrNull(option.leader) && this.leader(option.leader);\r\n\t\t\t!this.util.isUndefinedOrNull(option.pos) && this.pos(option.pos);\r\n\t\t\t!this.util.isUndefinedOrNull(option.val) && this.val(option.val);\r\n\t\t}\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphTab);\r\n\tParagraphTab.prototype.constructor = ParagraphTab;\r\n\tNSDocxExport.prototype.ParagraphTab = ParagraphTab;\r\n\t\r\n\tParagraphTab.prototype.leader = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"leader\",value);\r\n\t};\r\n\t\r\n\tParagraphTab.prototype.pos = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"pos\",value);\r\n\t};\r\n\t\r\n\tParagraphTab.prototype.val = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"val\",value);\r\n\t};\r\n\t\r\n\tParagraphTab.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__objProp[key] = value;\r\n\t\t}\r\n\t\treturn this.__objProp[key];\r\n\t};\r\n\t\r\n\tParagraphTab.prototype.toXml = function()\r\n\t{\r\n\t\tvar attributes = {};\r\n\t\tfor(var paramKey in this.__objProp)\r\n\t\t{\r\n\t\t\tif(!this.util.isUndefinedOrNull(this.__objProp[paramKey]))\r\n\t\t\t{\r\n\t\t\t\tattributes[\"w:\" + paramKey] = this.__objProp[paramKey];\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(attributes).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:tab\",\r\n\t\t\t\tattributes: attributes,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtextAlignment.php\r\n\tvar ParagraphVAlignment = function(docxRef,value)\r\n\t{\r\n\t\tthis.__value = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.value(value);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,ParagraphVAlignment);\r\n\tParagraphVAlignment.prototype.constructor = ParagraphVAlignment;\r\n\tNSDocxExport.prototype.ParagraphVAlignment = ParagraphVAlignment;\r\n\t\r\n\tParagraphVAlignment.prototype.value = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__value = value;\r\n\t\t}\r\n\t\treturn this.__value;\r\n\t};\r\n\t\r\n\tParagraphVAlignment.prototype.toXml = function()\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(this.__value))\r\n\t\t{\r\n\t\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:textAlignment\",\r\n\t\t\t\tattributes: {\"w:val\": this.__value},\r\n\t\t\t});\r\n\t\t\treturn xml;\r\n\t\t}\r\n\t\treturn null;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtext.php\r\n\tvar Run = function(docxRef,option)\r\n\t{\r\n\t\tthis.__format = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Run);\r\n\tRun.prototype.constructor = Run;\r\n\tNSDocxExport.prototype.Run = Run;\r\n\t\r\n\tRun.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif(option.text)\r\n\t\t\t{\r\n\t\t\t\tvar text = this.addText(option.text);\r\n\t\t\t}\r\n\t\t\tthis.format(option);\r\n\t\t}\r\n\t};\r\n\t\r\n\tRun.prototype.format = function(value)\r\n\t{\r\n\t\tif(value && value instanceof RunFormat)\r\n\t\t{\r\n\t\t\tthis.__format = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t!this.__format && (this.__format = new RunFormat(this.__docxRef,value));\r\n\t\t}\r\n\t\treturn this.__format;\r\n\t};\r\n\t\r\n\tRun.prototype.addText = function(str,spaceAttr)\r\n\t{\r\n\t\tvar text = new Text(this.__docxRef,str,spaceAttr);\r\n\t    this.__children.push(text);\r\n\t    return text;\r\n\t};\r\n\t\r\n\tRun.prototype.addBreak = function(type,clear)\r\n\t{\r\n\t\tvar runBreak = new RunBreak(this.__docxRef,type,clear);\r\n\t    this.__children.push(runBreak);\r\n\t    return runBreak;\r\n\t};\r\n\t\r\n\tRun.prototype.addInstrText = function(str,spaceType)\r\n\t{\r\n\t\tvar instr = this.__exportUtil.getInstrText(str,spaceType);\r\n\t\tthis.__children.push(instr);\r\n\t\treturn instr;\r\n\t};\r\n\t\r\n\tRun.prototype.addFldChar = function(charType)\r\n\t{\r\n\t\tvar fldChar = this.__exportUtil.getFldChar(charType);\r\n\t\tthis.__children.push(fldChar);\r\n\t\treturn fldChar;\r\n\t};\r\n\t\r\n\tRun.prototype.toXml = function()\r\n\t{\r\n\t\t//format should be at start\r\n\t\tif(this.__format)\r\n\t\t{\r\n\t\t\tthis.__children.unshift(this.__format);\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:r\");\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPstyleCharStyles.php\r\n\tvar RunFormat = function(docxRef,option)\r\n\t{\r\n\t\tthis.__style = {bold:{value:false,tag: \"w:b\",attr:\"w:val\"},italic:{value:false,tag: \"w:i\",attr:\"w:val\"},color:{value:null,tag:\"w:color\",attr:\"w:val\"},\r\n\t\t\t\t\t\tunderline:{value: null},size:{value:null,tag:\"w:sz\",attr:\"w:val\"},sizeCs:{value:null,tag:\"w:szCs\",attr:\"w:val\"},\r\n\t\t\t\t\t\trightToLeft:{value:null,tag:\"w:rtl\",attr:\"w:val\"},smallCaps:{value:false,tag: \"w:smallCaps\"},caps:{value:false,tag: \"w:caps\"},\r\n\t\t\t\t\t\tstrike:{value:false,tag:\"w:strike\",attr:\"w:val\"},doubleStrike:{value:false,tag:\"w:dstrike\",attr:\"w:val\"},\r\n\t\t\t\t\t\tsubScript:{value:false,tag: \"w:subscript\"},superScript:{value:false,tag: \"w:superscript\"},\r\n\t\t\t\t\t\tstyleID:{value:null,tag:\"w:rStyle\",attr:\"w:val\"},highlight:{value:null,tag:\"w:highlight\",attr:\"w:val\"},highlightCs:{value:null,tag:\"w:highlightCs\",attr:\"w:val\"},\r\n\t\t\t\t\t\tshadow:{value: null},shadowCs:{value: null},\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t};\r\n\t\tthis.__fonts = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tthis.setProperties(option);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,RunFormat);\r\n\tRunFormat.prototype.constructor = RunFormat;\r\n\tNSDocxExport.prototype.RunFormat = RunFormat;\r\n\t\r\n\tRunFormat.prototype.setProperties = function(option)\r\n\t{\r\n\t\tif(option)\r\n\t\t{\r\n\t\t\tif (option.bold) \r\n\t\t\t{\r\n\t            this.bold(true);\r\n\t        }\r\n\t\t\tif (option.italic) \r\n\t\t\t{\r\n\t\t\t\tthis.italic(true);\r\n\t        }\r\n\t        if (option.underline) \r\n\t        {\r\n\t        \tthis.underline(option.underline.type, option.underline.color);\r\n\t        }\r\n\t        if (option.color) \r\n\t        {\r\n\t        \tthis.color(option.color);\r\n\t        }\r\n\t        if (option.size) \r\n\t        {\r\n\t            this.size(option.size);\r\n\t        }\r\n\t        if (option.rightToLeft) \r\n\t        {\r\n\t        \tthis.rightToLeft(option.rightToLeft);\r\n\t        }\r\n\t        if (option.smallCaps) \r\n\t        {\r\n\t        \tthis.smallCaps(option.smallCaps);\r\n\t        }\r\n\t        if (option.caps) \r\n\t        {\r\n\t        \tthis.caps(option.caps);\r\n\t        }\r\n\t        if (option.strike) \r\n\t        {\r\n\t        \tthis.strike(option.strike);\r\n\t        }\r\n\t        if (option.doubleStrike) \r\n\t        {\r\n\t        \tthis.doubleStrike(option.doubleStrike);\r\n\t        }\r\n\t        if (option.subScript) \r\n\t        {\r\n\t        \tthis.subScript(option.subScript);\r\n\t        }\r\n\t        if (option.superScript) \r\n\t        {\r\n\t        \tthis.superScript(option.superScript);\r\n\t        }\r\n\t        if (option.highlight) \r\n\t        {\r\n\t            this.highlight.push(option.highlight);\r\n\t        }\r\n\t        if (option.shadow) \r\n\t        {\r\n\t            this.shadow(option.shadow.type,option.shadow.fill,option.shadow.color);\r\n\t        }\r\n\t        if (option.styleID) \r\n\t        {\r\n\t        \tthis.styleID(option.styleID);\r\n\t        }\r\n\t        if (option.font) \r\n\t        {\r\n\t            this.fonts(option.font);\r\n\t        }\r\n\t\t}\r\n\t};\r\n\t\r\n\tRunFormat.prototype.bold = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"bold\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.italic = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"italic\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.color = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"color\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.underline = function(type,color)\r\n\t{\r\n\t\ttype = type || \"single\";\r\n\t\tvar attr = {\"w:val\": type};\r\n\t\tif(color)\r\n\t\t{\r\n\t\t\tattr[\"w:color\"] = color;\r\n\t\t}\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:u\",\r\n\t\t\tattributes: attr\r\n\t\t});\r\n\t\treturn this.__setStyle(\"underline\",xml);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.size = function(value)\r\n\t{\r\n\t\tthis.__setStyle(\"sizeCs\",value);\r\n\t\treturn this.__setStyle(\"size\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.rightToLeft = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"rightToLeft\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.smallCaps = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"smallCaps\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.caps = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"caps\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.strike = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"strike\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.doubleStrike = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"doubleStrike\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.subScript = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"subScript\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.superScript = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"superScript\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.styleID = function(value)\r\n\t{\r\n\t\treturn this.__setStyle(\"styleID\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.highlight = function(value)\r\n\t{\r\n\t\tthis.__setStyle(\"highlightCs\",value);\r\n\t\treturn this.__setStyle(\"highlight\",value);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.shadow = function(value, fill, color)\r\n\t{\r\n\t\ttype = type || \"single\";\r\n\t\tvar attr = {\"w:val\": value,\"w:fill\": fill,\"w:color\" : color};\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:shdCs\",\r\n\t\t\tattributes: attr\r\n\t\t});\r\n\t\tthis.__setStyle(\"shadowCs\",xml);\r\n\t\txml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:shd\",\r\n\t\t\tattributes: attr\r\n\t\t});\r\n\t\treturn this.__setStyle(\"shadow\",xml);\r\n\t};\r\n\t\r\n\tRunFormat.prototype.fonts = function(value)\r\n\t{\r\n\t\tif(value && value instanceof RunFonts)\r\n\t\t{\r\n\t\t\tthis.__fonts = value;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__fonts = new RunFonts(this.__docxRef,value);\r\n\t\t}\r\n\t    return this.__fonts;\r\n\t};\r\n\t\r\n\tRunFormat.prototype.__setStyle = function(key,value)\r\n\t{\r\n\t\t//key = key.toLowerCase();\r\n\t\tif(this.__style[key])\r\n\t\t{\r\n\t\t\tthis.__style[key].value = value;\r\n\t\t}\r\n\t\treturn this.__style[key].value;\r\n\t};\r\n\t\r\n\tRunFormat.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar objItem = null;\r\n\t\tfor(var key in this.__style)\r\n\t\t{\r\n\t\t\titem = this.__style[key];\r\n\t\t\tif(item.value)\r\n\t\t\t{\r\n\t\t\t\tif(item.tag)\r\n\t\t\t\t{\r\n\t\t\t\t\tobjItem = {name: item.tag};\r\n\t\t\t\t\tif(item.attr)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tobjItem.attributes = {};\r\n\t\t\t\t\t\tobjItem.attributes[item.attr] = item.value;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.__children.push(this.__exportUtil.getXML(objItem));\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__children.push(item.value);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(this.__fonts)\r\n\t\t{\r\n\t\t\tvar fontXml = this.__fonts.toXml();\r\n\t\t\tif(fontXml)\r\n\t\t\t{\r\n\t\t\t\tthis.__children.push(fontXml);\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = this.base.toXml.call(this,\"w:rPr\");\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtextSpecialContent-break.php\r\n\tvar RunBreak = function(docxRef,type,clear)\r\n\t{\r\n\t\t//value can be column,page,textWrapping \r\n\t\tthis.__type = null;\r\n\t\t//value can be all,left,none,right \r\n\t\tthis.__clear = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\ttype && this.type(type);\r\n\t\tclear && this.clear(clear);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,RunBreak);\r\n\tRunFormat.prototype.constructor = RunBreak;\r\n\tNSDocxExport.prototype.RunBreak = RunBreak;\r\n\t\r\n\tRunBreak.prototype.type = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__type = value;\r\n\t\t}\r\n\t\treturn this.__type;\r\n\t};\r\n\t\r\n\tRunBreak.prototype.clear = function(value)\r\n\t{\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\tthis.__clear = value;\r\n\t\t}\r\n\t\treturn this.__clear;\r\n\t};\r\n\t\r\n\tRunBreak.prototype.toXml = function()\r\n\t{\r\n\t\tvar itemAttr = {};\r\n\t\t//default value\r\n\t\t!this.__type && (this.__type = \"textWrapping\");\r\n\t\titemAttr[\"w:type\"] = this.__type\r\n\t\tthis.__clear && (itemAttr[\"w:clear\"] = this.__clear);\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(itemAttr).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:br\",\r\n\t\t\t\tattributes: itemAttr,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtextFonts.php\r\n\tvar RunFonts = function(docxRef,option)\r\n\t{\r\n\t\tthis.__prop = {ascii:{value:null,tag: \"w:ascii\"},cs:{value:null,tag: \"w:cs\"},eastasia:{value:null,tag:\"w:eastAsia\"},hansi:{value:null,tag:\"w:hAnsi\"},hint:{value:null,tag:\"w:hint\"}};\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\toption = option || {};\r\n\t\t(option.ascii || option.name) && this.ascii(option.ascii || option.name);\r\n\t\t(option.cs || option.ascii || option.name) && this.cs(option.cs || option.ascii || option.name);\r\n\t\t(option.eastasia || option.ascii || option.name) && this.eastAsia(option.eastasia || option.ascii || option.name);\r\n\t\t(option.hansi || option.ascii || option.name) && this.hansi(option.hansi || option.ascii || option.name);\r\n\t\toption.hint && this.hint(option.hint);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,RunFonts);\r\n\tRunFonts.prototype.constructor = RunFonts;\r\n\tNSDocxExport.prototype.RunFonts = RunFonts;\r\n\t\r\n\tRunFonts.prototype.ascii = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"ascii\",value);\r\n\t};\r\n\t\r\n\tRunFonts.prototype.cs = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"cs\",value);\r\n\t};\r\n\t\r\n\tRunFonts.prototype.eastAsia = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"eastasia\",value);\r\n\t};\r\n\t\r\n\tRunFonts.prototype.hansi = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"hansi\",value);\r\n\t};\r\n\t\r\n\tRunFonts.prototype.hint = function(value)\r\n\t{\r\n\t\treturn this.__setProp(\"hint\",value);\r\n\t};\r\n\t\r\n\tRunFonts.prototype.__setProp = function(key,value)\r\n\t{\r\n\t\tkey = key.toLowerCase();\r\n\t\tif(this.__prop[key])\r\n\t\t{\r\n\t\t\tthis.__prop[key].value = value;\r\n\t\t}\r\n\t\treturn this.__prop[key].value;\r\n\t};\r\n\t\r\n\tRunFonts.prototype.toXml = function()\r\n\t{\r\n\t\tvar item = null;\r\n\t\tvar itemAttr = {};\r\n\t\tfor(var key in this.__prop)\r\n\t\t{\r\n\t\t\titem = this.__prop[key];\r\n\t\t\tif(item.value)\r\n\t\t\t{\r\n\t\t\t\titemAttr[item.tag] = item.value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar xml = null;\r\n\t\tif(Object.keys(itemAttr).length)\r\n\t\t{\r\n\t\t\txml = this.__exportUtil.getXML({\r\n\t\t\t\tname: \"w:rFonts\",\r\n\t\t\t\tattributes: itemAttr,\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\t//http://officeopenxml.com/WPtext.php\r\n\tvar Text = function(docxRef,str,spaceAttr)\r\n\t{\r\n\t\tthis.__str = null;\r\n\t\tthis.__spaceAttr = null;\r\n\t\tthis.base.init.call(this,docxRef);\r\n\t\tstr && this.string(str);\r\n\t\tspaceAttr && this.spaceAttr(spaceAttr);\r\n\t};\r\n\t\r\n\tnsExtendPrototype(BaseElement,Text);\r\n\tText.prototype.constructor = Text;\r\n\tNSDocxExport.prototype.Text = Text;\r\n\t\r\n\tText.prototype.string = function(value)\r\n\t{\r\n\t\tif (!this.util.isUndefinedOrNull(value)) \r\n\t\t{\r\n\t\t\tthis.__str = value;\r\n\t\t}\r\n\t\treturn this.__str;\r\n\t};\r\n\t\r\n\tText.prototype.spaceAttr = function(value)\r\n\t{\r\n\t\tif (!this.util.isUndefinedOrNull(value)) \r\n\t\t{\r\n\t\t\tthis.__spaceAttr = value;\r\n\t\t}\r\n\t\treturn this.__spaceAttr;\r\n\t};\r\n\t\r\n\tText.prototype.toXml = function(value)\r\n\t{\r\n\t\tvar xml = this.__exportUtil.getXML({\r\n\t\t\tname: \"w:t\",\r\n\t\t\tattributes: {\"xml:space\": this.__spaceAttr || \"preserve\"},\r\n\t\t\tchildren: [this.__str || \"\"]\r\n\t\t});\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\tvar ExportUtil = function(util)\r\n\t{\r\n\t\tthis.util = util;\r\n\t\tthis.xmlPrefix = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\\n';\r\n\t\tthis.schemas = {\r\n\t\t\t\t'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',\r\n\t\t\t\t'mx': 'http://schemas.microsoft.com/office/mac/excel/2008/main',\r\n\t\t\t\t'mc': 'http://schemas.openxmlformats.org/markup-compatibility/2006',\r\n\t\t\t\t'mv': 'urn:schemas-microsoft-com:mac:vml',\r\n\t\t\t\t'x14': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main',\r\n\t\t\t\t'x14ac': 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac',\r\n\t\t\t\t'xm': 'http://schemas.microsoft.com/office/excel/2006/main',\r\n\t\t\t\t'spreadsheetml': 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',\r\n\t\t\t\t'relationshipPackage': 'http://schemas.openxmlformats.org/package/2006/relationships',\r\n\t\t\t\t'worksheet': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',\r\n\t\t\t\t'stylesheet': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',\r\n\t\t\t\t'sharedStrings': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',\r\n\t\t\t\t'contentTypes': 'http://schemas.openxmlformats.org/package/2006/content-types',\r\n\t\t\t\t'officeDocument': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',\r\n\t\t\t\t'package': 'http://schemas.openxmlformats.org/package/2006/relationships',\r\n\t\t\t\t'table': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table',\r\n\t\t\t\t'spreadsheetDrawing': 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing',\r\n\t\t\t\t'drawing': 'http://schemas.openxmlformats.org/drawingml/2006/main',\r\n\t\t\t\t'drawingRelationship': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',\r\n\t\t\t\t'image': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',\r\n\t\t\t\t'chart': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',\r\n\t\t\t\t'hyperlink': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink'\r\n\t\t};\r\n\t\tthis.newLine = \"\\n\";\r\n\t\tthis.defaultFormat = true;\r\n\t};\r\n\t\t\r\n\tExportUtil.prototype.getXML = function(config) \r\n\t{\r\n\t\tvar retValue = '<' + config.name;\r\n\t\tvar content = '';\r\n\t\tvar xmlPrefixAdded = false;\r\n\t\tif(config.addXmlPrefix)\r\n\t\t{\r\n\t\t\tretValue = this.xmlPrefix + retValue;\r\n\t\t\txmlPrefixAdded = true;\r\n\t\t}\r\n\t\tif (config.ns) \r\n\t\t{\r\n\t\t\tretValue = (xmlPrefixAdded ? \"\" : this.xmlPrefix) + retValue + ' xmlns=\"' + this.schemas[config.ns] + '\"';\r\n\t\t}\r\n\t\tif (config.attributes) \r\n\t\t{\r\n\t\t\tfor(var key in config.attributes)\r\n\t\t\t{\r\n\t\t\t\tretValue += ' ' + key + '=\"' + this.escapeString(config.attributes[key]) + '\"';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!this.util.isUndefinedOrNull(config.value)) \r\n\t\t{\r\n\t\t\tcontent += this.escapeString(config.value);\r\n\t\t}\r\n\t\tif (config.children) \r\n\t\t{\r\n\t\t\tcontent += config.children.join('');\r\n\t\t}\r\n\t\tif (content) \r\n\t\t{\r\n\t\t\tretValue += '>' + content + '</' + config.name + '>';\r\n\t\t} \r\n\t\telse \r\n\t\t{\r\n\t\t\tretValue += '/>';\r\n\t\t}\r\n\t\tif(this.util.isUndefinedOrNull(config.format))\r\n\t\t{\r\n\t\t\tconfig.format = this.defaultFormat;\r\n\t\t}\r\n\t\treturn (config.format ? this.formatXml(retValue) : retValue);\r\n\t\t//return this.formatXml(retValue);\r\n\t};\r\n\t\r\n\tExportUtil.prototype.escapeString = function(str)\r\n\t{\r\n\t\treturn str;\r\n\t};\r\n\t\r\n\tExportUtil.prototype.formatXml = function(xml,space)\r\n\t{\r\n\t\tvar retValue = \"\";\r\n\t\tvar indent= \"\";\r\n\t\tspace = space || \"\\t\";\r\n\t\tvar arrXml = xml.split(/>\\s*</);\r\n\t\tvar tag = \"\";\r\n\t\tfor(var count = 0;count < arrXml.length;count++)\r\n\t\t{\r\n\t\t\ttag = arrXml[count];\r\n\t\t\t//decrease space\r\n\t\t\tif(tag.match(/^\\/\\w/)) \r\n\t\t\t{\r\n\t\t\t\tindent = indent.substring(space.length);\r\n\t\t\t}\r\n\t\t\tretValue += indent + \"<\" + tag + \">\\r\\n\";\r\n\t\t\t//increase space\r\n\t\t\tif(tag.match(/^<?\\w[^>]*[^\\/]$/)) \r\n\t\t\t{\r\n\t\t\t\tindent += space;\r\n\t\t\t}\r\n\t\t}\r\n\t\tretValue = retValue.substring(1, retValue.length - 3);\r\n\t\treturn retValue;\r\n\t};\r\n\t\r\n\tExportUtil.prototype.cloneObject = function(objSrc)\r\n\t{\r\n\t\treturn JSON.parse(JSON.stringify(objSrc));\r\n\t};\r\n\t\r\n\tExportUtil.prototype.getNonNullString = function(str)\r\n\t{\r\n\t\treturn str = str || \"\";\r\n\t};\r\n\t\r\n\tExportUtil.prototype.getInstrText = function(str,spaceType)\r\n\t{\r\n\t\treturn \"<w:instrText xml:space=\\\"\" + (spaceType || \"preserve\") + \"\\\">\" + str + \"</w:instrText>\";\r\n\t};\r\n\t\r\n\tExportUtil.prototype.getFldChar = function(charType)\r\n\t{\r\n\t\treturn \"<w:fldChar w:fldCharType=\\\"\" + charType + \"\\\"/>\";\r\n\t};\r\n\t\r\n\tExportUtil.prototype.addFunctions = function(instance,objItemsName,option,callback,docxRef)\r\n\t{\r\n\t\tvar objProp = this.util.isString(objItemsName) ? instance[objItemsName] : objItemsName;\r\n\t\tif(objProp && Object.keys(objProp).length)\r\n\t\t{\r\n\t\t\tvar defaultCallback = function(value,paramItem,key,paramInstance)\r\n\t\t\t{\r\n\t\t\t\tif(value && value instanceof NSDocxExport.prototype[paramItem.className])\r\n\t\t\t\t{\r\n\t\t\t\t\tparamItem.value = value;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t!paramItem.value && (paramItem.value = new NSDocxExport.prototype[paramItem.className](docxRef,value));\r\n\t\t\t\t}\r\n\t\t\t\treturn paramItem.value;\r\n\t\t\t};\r\n\t\t\tcallback = callback || defaultCallback;\r\n\t\t\tvar item = objProp[Object.keys(objProp)[0]];\r\n\t\t\tif(!instance[item.method])\r\n\t\t\t{\r\n\t\t\t\toption = option || {};\r\n\t\t\t\tfor(var key in objProp)\r\n\t\t\t\t{\r\n\t\t\t\t\titem = objProp[key];\r\n\t\t\t\t\t(function(item,key)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(!instance[item.method])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tinstance[item.method] = function(value)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\treturn callback(value,item,key,instance);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(option[key])\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tinstance[item.method](option[key]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})(item,key)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tExportUtil.prototype.addSingleValueFunctions = function(instance,objItemsName,option,docxRef)\r\n\t{\r\n\t\tvar callback = function(value,paramItem,key,paramInstance)\r\n\t\t{\r\n\t\t\tif(!paramInstance.util.isUndefinedOrNull(value))\r\n\t\t\t{\r\n\t\t\t\tparamItem.value = value;\r\n\t\t\t}\r\n\t\t\treturn paramItem.value;\r\n\t\t};\r\n\t\tthis.addFunctions(instance,objItemsName,option,callback,docxRef);\r\n\t};\r\n\t\r\n\tExportUtil.prototype.getValXml = function(value,xmlTag)\r\n\t{\r\n\t\tvar xml = null;\r\n\t\tif(!this.util.isUndefinedOrNull(value))\r\n\t\t{\r\n\t\t\txml = this.getXML({\r\n\t\t\t\tname: xmlTag,\r\n\t\t\t\tattributes: {\"w:val\": value},\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn xml;\r\n\t};\r\n\t\r\n\treturn NSDocxExport;\r\n})();\r\nnsModuleExport(this,\"NSDocxExport\",NSDocxExport);";
