diff --git a/public/locales/en.json b/public/locales/en.json index f19d1c5..4829694 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -219,7 +219,7 @@ "AutoXLSCol": "Autosize column (xlsx only)", "AutoXLSRow": "Autosize row (xlsx only)", "NotAvailIndicator": "What to use if a field can't be found", - "Delimiter": "Delimiter to use with a text based field (Use space for none)" + "QualifierCSV": "Qualifier to use with a text based field for CSV (Use space for none)" }, "LevelInfo": "Export level determines which data are going to be exported.", "ExportLevel": "Export Level", diff --git a/src/components/modules/ExportTools/Settings/settings.vue b/src/components/modules/ExportTools/Settings/settings.vue index 0fdd693..fbf7d73 100644 --- a/src/components/modules/ExportTools/Settings/settings.vue +++ b/src/components/modules/ExportTools/Settings/settings.vue @@ -14,8 +14,8 @@ - - + + @@ -60,7 +60,7 @@ return { outDirVal: wtconfig.get('ET.OutPath', i18n.t('Modules.ET.Settings.SelectOutDir')), ArraySep: wtconfig.get('ET.ArraySep'), - TextSep: wtconfig.get('ET.TextSep', '"'), + TextQualifierCSV: wtconfig.get('ET.TextQualifierCSV', '"'), NotAvailIndicator: wtconfig.get('ET.NotAvail', 'N/A'), ColumnSep: '', TimeOut: wtconfig.get('PMS.TimeOut'), @@ -127,8 +127,8 @@ setArraySep: function(){ wtconfig.set('ET.ArraySep', this.ArraySep) }, - setTextSep: function(){ - wtconfig.set('ET.TextSep', this.TextSep) + setTextQualifierCSV: function(){ + wtconfig.set('ET.TextQualifierCSV', this.TextQualifierCSV) }, setNotAvailIndicator: function(){ wtconfig.set('ET.NotAvail', this.NotAvailIndicator) diff --git a/src/components/modules/ExportTools/scripts/et.js b/src/components/modules/ExportTools/scripts/et.js index d01f94b..20e372d 100644 --- a/src/components/modules/ExportTools/scripts/et.js +++ b/src/components/modules/ExportTools/scripts/et.js @@ -617,7 +617,7 @@ const excel2 = new class Excel { let lookup, val, array, i, valArray, valArrayVal, subType, subKey let str = '' let result = '' - let textSep = wtconfig.get('ET.TextSep', '"'); + let textSep = wtconfig.get('ET.TextQualifierCSV', '"'); if ( textSep === ' ') { textSep = ''; @@ -778,11 +778,20 @@ const excel2 = new class Excel { }); var lineno = 0; + + const TextQualifierCSV = wtconfig.get('ET.TextQualifierCSV', '"'); + const bReplace = (TextQualifierCSV != ''); + var newLine; lineReader.on('line', async function (line) { // Skip first line - if (lineno != 0){ - //var lineArr = line.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); - var lineArr = line.split( wtconfig.get('ET.ColumnSep', ',')); + if (lineno != 0){ + if (bReplace){ + newLine = line.replaceAll(TextQualifierCSV,''); + } + else { + newLine = line + } + var lineArr = newLine.split( wtconfig.get('ET.ColumnSep', ',')); await sheet.addRow(lineArr); } lineno++;