Skip to content
Snippets Groups Projects
Commit 938ba84e authored by Sascha Schmidt's avatar Sascha Schmidt
Browse files

[Projekt: xRM-ContactManagement][TicketNr.: 1083127][XML character werden für...

[Projekt: xRM-ContactManagement][TicketNr.: 1083127][XML character werden für Platzhalter bei docx nicht escaped]
parent 4ca5dcc7
No related branches found
No related tags found
No related merge requests found
import("system.logging");
import("system.vars");
import("system.vars");
import("system.result");
import("Sql_lib");
......
......@@ -463,6 +463,10 @@ DocumentTemplate.prototype.getReplacedContent = function (pReplacements)
return this._getReplacedODT(pReplacements);
case DocumentTemplate.types.DOCX:
case DocumentTemplate.types.DOCM:
for (let i in pReplacements)
{
pReplacements[i] = Utils.escapeXmlCharacters(pReplacements[i]);
}
return this._getReplacedDOCX(pReplacements);
case DocumentTemplate.types.PLAIN:
let plainText = this._replaceText(this.content, pReplacements);
......
......@@ -532,6 +532,21 @@ Utils.buildFilterObj = function(pFilterObj, pFieldName, pOperator, pContentType,
return parentFilter;
}
/**
* Escapes all special characters for a XML-String
*
* @param {String} pString a string for escaping xml-chars
* @return {String} XML-escaped string
*/
Utils.escapeXmlCharacters = function(pString) {
return pString
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&apos;");
}
/**
* Class containing static utility functions for regular expression objects (RegExp)
* Do not create an instance of this
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment