From cab0b29c3890a87553d24c254bf18367272a6f6a Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Thu, 4 May 2017 14:03:32 +0300 Subject: [PATCH] add ConvertService.ashx delimiterChar param for open/save csv with user defined delimiters --- Common/sources/commondefines.js | 8 ++++++++ DocService/sources/converterservice.js | 3 ++- FileConverter/sources/converter.js | 6 ++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Common/sources/commondefines.js b/Common/sources/commondefines.js index ba89aecf..fcbac9d1 100644 --- a/Common/sources/commondefines.js +++ b/Common/sources/commondefines.js @@ -51,6 +51,7 @@ function InputCommand(data) { this['saveindex'] = data['saveindex']; this['codepage'] = data['codepage']; this['delimiter'] = data['delimiter']; + this['delimiterChar'] = data['delimiterChar']; this['embeddedfonts'] = data['embeddedfonts']; if (data['mailmergesend']) { this['mailmergesend'] = new CMailMergeSendData(data['mailmergesend']); @@ -99,6 +100,7 @@ function InputCommand(data) { //nullable this['codepage'] = undefined; this['delimiter'] = undefined; + this['delimiterChar'] = undefined; this['embeddedfonts'] = undefined;//bool this['mailmergesend'] = undefined; this['thumbnail'] = undefined; @@ -201,6 +203,12 @@ InputCommand.prototype = { setDelimiter: function(data) { this['delimiter'] = data; }, + getDelimiterChar: function() { + return this['delimiterChar']; + }, + setDelimiterChar: function(data) { + this['delimiterChar'] = data; + }, getEmbeddedFonts: function() { return this['embeddedfonts']; }, diff --git a/DocService/sources/converterservice.js b/DocService/sources/converterservice.js index 055b8279..10570eb3 100644 --- a/DocService/sources/converterservice.js +++ b/DocService/sources/converterservice.js @@ -218,7 +218,8 @@ function convertRequest(req, res) { cmd.setOutputFormat(formatChecker.getFormatFromString(outputtype)); cmd.setCodepage(commonDefines.c_oAscEncodingsMap[params.codePage] || commonDefines.c_oAscCodePageUtf8); cmd.setDelimiter(parseIntParam(params.delimiter) || commonDefines.c_oAscCsvDelimiter.Comma); - cmd.setDoctParams(parseIntParam(params.doctparams)); + if(undefined != params.delimiterChar) + cmd.setDelimiterChar(params.delimiterChar); cmd.setPassword(params.password); var thumbnail = params.thumbnail; if (thumbnail) { diff --git a/FileConverter/sources/converter.js b/FileConverter/sources/converter.js index ba1aedf5..e749ff4f 100644 --- a/FileConverter/sources/converter.js +++ b/FileConverter/sources/converter.js @@ -79,8 +79,9 @@ function TaskQueueDataConvert(task) { this.fileFrom = null; this.fileTo = null; this.formatTo = cmd.outputformat; - this.csvTxtEncoding = cmd.codepage; - this.csvDelimiter = cmd.delimiter; + this.csvTxtEncoding = cmd.getCodepage(); + this.csvDelimiter = cmd.getDelimiter(); + this.csvDelimiterChar = cmd.getDelimiterChar(); this.paid = task.getPaid(); this.embeddedFonts = cmd.embeddedfonts; this.fromChanges = task.getFromChanges(); @@ -108,6 +109,7 @@ TaskQueueDataConvert.prototype = { xml += this.serializeXmlProp('m_nFormatTo', this.formatTo); xml += this.serializeXmlProp('m_nCsvTxtEncoding', this.csvTxtEncoding); xml += this.serializeXmlProp('m_nCsvDelimiter', this.csvDelimiter); + xml += this.serializeXmlProp('m_nCsvDelimiterChar', this.csvDelimiterChar); xml += this.serializeXmlProp('m_bPaid', this.paid); xml += this.serializeXmlProp('m_bEmbeddedFonts', this.embeddedFonts); xml += this.serializeXmlProp('m_bFromChanges', this.fromChanges);