mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-29 06:20:26 +00:00
#238 fixed
This commit is contained in:
parent
94189c1783
commit
232702d671
3 changed files with 19 additions and 10 deletions
|
@ -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",
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<b-input-group id="ArraySepGrp" :prepend="$t('Modules.ET.Settings.ArraySep')" class="mt-3">
|
||||
<b-form-input id="ArraySep" name="ArraySep" type="text" class="form-control" v-model="ArraySep" :disabled=false :maxlength=1 @change="setArraySep()"></b-form-input>
|
||||
</b-input-group>
|
||||
<b-input-group id="TextSepGrp" :prepend="$t('Modules.ET.Settings.Delimiter')" class="mt-3">
|
||||
<b-form-input id="TextSep" name="TextSep" type="text" class="form-control" v-model="TextSep" :disabled=false :maxlength=1 @change="setTextSep()"></b-form-input>
|
||||
<b-input-group id="setTextQualifierCSVGrp" :prepend="$t('Modules.ET.Settings.QualifierCSV')" class="mt-3">
|
||||
<b-form-input id="TextQualifierCSV" name="TextQualifierCSV" type="text" class="form-control" v-model="TextQualifierCSV" :disabled=false :maxlength=1 @change="setTextQualifierCSV()"></b-form-input>
|
||||
</b-input-group>
|
||||
<b-input-group id="NotAvailIndicatorGrp" :prepend="$t('Modules.ET.Settings.NotAvailIndicator')" class="mt-3">
|
||||
<b-form-input id="NotAvailIndicator" name="NotAvailIndicator" type="text" class="form-control" v-model="NotAvailIndicator" :disabled=false @change="setNotAvailIndicator()"></b-form-input>
|
||||
|
@ -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)
|
||||
|
|
|
@ -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 (bReplace){
|
||||
newLine = line.replaceAll(TextQualifierCSV,'');
|
||||
}
|
||||
else {
|
||||
newLine = line
|
||||
}
|
||||
var lineArr = newLine.split( wtconfig.get('ET.ColumnSep', ','));
|
||||
await sheet.addRow(lineArr);
|
||||
}
|
||||
lineno++;
|
||||
|
|
Loading…
Reference in a new issue