Skip to content

Commit 978311d

Browse files
author
Open Lowcode SAS
committed
Close #48
1 parent e19b262 commit 978311d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/org/openlowcode/server/data/loader/FlatFileExtractor.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ private void loadWorkbook(Sheet sheet,Sheet referencessheet, E[] objectarray, St
369369
int rowindex = 1;
370370
CellStyle normalstyle = createBorderedStyle(sheet.getWorkbook());
371371
logger.info("parsing objects in array, nr = " + objectarray.length);
372-
372+
String[] context = new String[] { null };
373373
for (int i = 0; i < objectarray.length; i++) {
374374
E currentobject = objectarray[i];
375-
String[] context = new String[] { null };
375+
376376
if (complexextractor != null)
377377
context = complexextractor.initComplexExtractorForObject(currentobject);
378378
logger.finer("for line " + i + ", context length = " + context.length);
@@ -399,11 +399,21 @@ private void loadWorkbook(Sheet sheet,Sheet referencessheet, E[] objectarray, St
399399

400400
}
401401

402+
// format two more lines to allow people to use data to enter template
403+
for (int i = 0; i < 2; i++) {
404+
Row datarow = sheet.createRow(rowindex);
405+
rowindex++;
406+
for (int k = 0; k < aliaslisttoconsider.length; k++) {
407+
Cell cell = datarow.createCell(k);
408+
cell.setCellStyle(normalstyle);
409+
}
410+
411+
}
402412
// Put restrictions on cells if exists
403413
for (int i=0;i<aliaslisttoconsider.length;i++) {
404414
String[] restrictions = restrictionsperalias.get(i);
405415
if (restrictions!=null) {
406-
setRestrictionsOnCell(sheet,referencessheet,i,restrictions.length,rowindex-2);
416+
setRestrictionsOnCell(sheet,referencessheet,i,restrictions.length,rowindex+1);
407417
}
408418
}
409419

@@ -505,7 +515,7 @@ public static void setRestrictionsOnCell(Sheet mainsheet,Sheet restrictionsheet
505515
String columnletter = CellReference.convertNumToColString(column);
506516
String formula = "'"+restrictionsheet.getSheetName()+ "'!$"+columnletter+"$"+1+":$"+columnletter+"$"+nbofchoices;
507517
DataValidationConstraint constraint = validationHelper.createFormulaListConstraint(formula);
508-
CellRangeAddressList addressList = new CellRangeAddressList(1,nbofrows+1,column,column);
518+
CellRangeAddressList addressList = new CellRangeAddressList(1,nbofrows,column,column);
509519

510520
DataValidation dataValidation = validationHelper.createValidation(constraint, addressList);
511521
dataValidation.setErrorStyle(DataValidation.ErrorStyle.STOP);

0 commit comments

Comments
 (0)