Program: 39940
Project: 39940
Buggy source:
private Sheet generateDeclarationEtcBOHeader(List<MaterialExtension> extensions,Sheet sheet){
  Field[] fields=DeclarationEtcBO.class.getDeclaredFields();
  Row r1=sheet.createRow(0);
  Row r2=sheet.createRow(1);
  Cell numcell=r1.createCell(0);
  numcell.setCellValue("String_Node_Str");
  CellRangeAddress region=new CellRangeAddress(0,1,0,0);
  sheet.addMergedRegion(region);
  int count=1;
  for (  Field field : fields) {
    field.setAccessible(true);
    if (field.isAnnotationPresent(ExcelHeader.class)) {
      ExcelHeader excelHeader=(ExcelHeader)field.getAnnotation(ExcelHeader.class);
      String headerName=excelHeader.header();
      if (StringUtil.notEmpty(headerName)) {
switch (headerName) {
case "String_Node_Str":
{
            Cell r1cell=r1.createCell(count);
            r1cell.setCellValue(headerName);
            region=new CellRangeAddress(0,0,count,count + 3);
            sheet.addMergedRegion(region);
            Cell r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,3 * 512);
            count++;
            break;
          }
case "String_Node_Str":
{
          Cell r1cell=r1.createCell(count);
          r1cell.setCellValue(headerName);
          region=new CellRangeAddress(0,0,count,count + 2);
          sheet.addMergedRegion(region);
          Cell r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,5 * 512);
          count++;
          r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,5 * 512);
          count++;
          r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,3 * 512);
          count++;
          break;
        }
case "String_Node_Str":
{
        Cell r1cell=r1.createCell(count);
        r1cell.setCellValue(headerName);
        region=new CellRangeAddress(0,0,count,count + 2);
        sheet.addMergedRegion(region);
        Cell r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        break;
      }
case "String_Node_Str":
{
      Cell r1cell=r1.createCell(count);
      r1cell.setCellValue(headerName);
      region=new CellRangeAddress(0,0,count,count + 2);
      sheet.addMergedRegion(region);
      Cell r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,7 * 512);
      count++;
      r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,3 * 512);
      count++;
      r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,3 * 512);
      count++;
      break;
    }
case "String_Node_Str":
{
    Cell r1cell=r1.createCell(count);
    r1cell.setCellValue(headerName);
    region=new CellRangeAddress(0,0,count,count + 1);
    sheet.addMergedRegion(region);
    Cell r2cell=r2.createCell(count);
    r2cell.setCellValue("String_Node_Str");
    sheet.setColumnWidth(count,5 * 512);
    count++;
    r2cell=r2.createCell(count);
    r2cell.setCellValue("String_Node_Str");
    sheet.setColumnWidth(count,5 * 512);
    count++;
    break;
  }
case "String_Node_Str":
{
  Cell r1cell=r1.createCell(count);
  r1cell.setCellValue(headerName);
  region=new CellRangeAddress(0,0,count,count + 2);
  sheet.addMergedRegion(region);
  Cell r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 4);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 5);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,4 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 4);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,7 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 3);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,9 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
if (extensions == null || extensions.isEmpty()) {
break;
}
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + extensions.size());
sheet.addMergedRegion(region);
for (MaterialExtension extension : extensions) {
Cell cell=r2.createCell(count);
String extensionName=extension.getExtensionName() == null ? "String_Node_Str" : extension.getExtensionName();
cell.setCellValue(extensionName);
int length=extension.getExtensionName().length() > 10 ? 10 : extension.getExtensionName().length();
sheet.setColumnWidth(count,length * 512);
count++;
}
break;
}
default :
Cell cell=r1.createCell(count);
sheet.setColumnWidth(count,(headerName.length() + 1) * 512);
cell.setCellValue(headerName);
region=new CellRangeAddress(0,1,count,count);
sheet.addMergedRegion(region);
count++;
break;
}
}
}
}
return sheet;
}

Fixed version (ground truth):
private Sheet generateDeclarationEtcBOHeader(List<MaterialExtension> extensions,Sheet sheet){
  Field[] fields=DeclarationEtcBO.class.getDeclaredFields();
  Row r1=sheet.createRow(0);
  Row r2=sheet.createRow(1);
  Cell numcell=r1.createCell(0);
  numcell.setCellValue("String_Node_Str");
  CellRangeAddress region=new CellRangeAddress(0,1,0,0);
  sheet.addMergedRegion(region);
  int count=1;
  for (  Field field : fields) {
    field.setAccessible(true);
    if (field.isAnnotationPresent(ExcelHeader.class)) {
      ExcelHeader excelHeader=(ExcelHeader)field.getAnnotation(ExcelHeader.class);
      String headerName=excelHeader.header();
      if (StringUtil.notEmpty(headerName)) {
switch (headerName) {
case "String_Node_Str":
{
            Cell r1cell=r1.createCell(count);
            r1cell.setCellValue(headerName);
            region=new CellRangeAddress(0,0,count,count + 3);
            sheet.addMergedRegion(region);
            Cell r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,5 * 512);
            count++;
            r2cell=r2.createCell(count);
            r2cell.setCellValue("String_Node_Str");
            sheet.setColumnWidth(count,3 * 512);
            count++;
            break;
          }
case "String_Node_Str":
{
          Cell r1cell=r1.createCell(count);
          r1cell.setCellValue(headerName);
          region=new CellRangeAddress(0,0,count,count + 2);
          sheet.addMergedRegion(region);
          Cell r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,5 * 512);
          count++;
          r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,5 * 512);
          count++;
          r2cell=r2.createCell(count);
          r2cell.setCellValue("String_Node_Str");
          sheet.setColumnWidth(count,3 * 512);
          count++;
          break;
        }
case "String_Node_Str":
{
        Cell r1cell=r1.createCell(count);
        r1cell.setCellValue(headerName);
        region=new CellRangeAddress(0,0,count,count + 2);
        sheet.addMergedRegion(region);
        Cell r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        r2cell=r2.createCell(count);
        r2cell.setCellValue("String_Node_Str");
        sheet.setColumnWidth(count,5 * 512);
        count++;
        break;
      }
case "String_Node_Str":
{
      Cell r1cell=r1.createCell(count);
      r1cell.setCellValue(headerName);
      region=new CellRangeAddress(0,0,count,count + 2);
      sheet.addMergedRegion(region);
      Cell r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,7 * 512);
      count++;
      r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,3 * 512);
      count++;
      r2cell=r2.createCell(count);
      r2cell.setCellValue("String_Node_Str");
      sheet.setColumnWidth(count,3 * 512);
      count++;
      break;
    }
case "String_Node_Str":
{
    Cell r1cell=r1.createCell(count);
    r1cell.setCellValue(headerName);
    region=new CellRangeAddress(0,0,count,count + 1);
    sheet.addMergedRegion(region);
    Cell r2cell=r2.createCell(count);
    r2cell.setCellValue("String_Node_Str");
    sheet.setColumnWidth(count,5 * 512);
    count++;
    r2cell=r2.createCell(count);
    r2cell.setCellValue("String_Node_Str");
    sheet.setColumnWidth(count,5 * 512);
    count++;
    break;
  }
case "String_Node_Str":
{
  Cell r1cell=r1.createCell(count);
  r1cell.setCellValue(headerName);
  region=new CellRangeAddress(0,0,count,count + 2);
  sheet.addMergedRegion(region);
  Cell r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  r2cell=r2.createCell(count);
  r2cell.setCellValue("String_Node_Str");
  sheet.setColumnWidth(count,5 * 512);
  count++;
  break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 4);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 5);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,4 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 4);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,7 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 3);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,9 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,3 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
region=new CellRangeAddress(0,0,count,count + 2);
sheet.addMergedRegion(region);
Cell r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
r2cell=r2.createCell(count);
r2cell.setCellValue("String_Node_Str");
sheet.setColumnWidth(count,5 * 512);
count++;
break;
}
case "String_Node_Str":
{
if (extensions == null || extensions.isEmpty()) {
break;
}
Cell r1cell=r1.createCell(count);
r1cell.setCellValue(headerName);
if (extensions.size() > 1) {
region=new CellRangeAddress(0,0,count,count + extensions.size() - 1);
sheet.addMergedRegion(region);
}
for (MaterialExtension extension : extensions) {
Cell cell=r2.createCell(count);
String extensionName=extension.getExtensionName() == null ? "String_Node_Str" : extension.getExtensionName();
cell.setCellValue(extensionName);
int length=extension.getExtensionName().length() > 10 ? 10 : extension.getExtensionName().length();
sheet.setColumnWidth(count,length * 512);
count++;
}
break;
}
default :
Cell cell=r1.createCell(count);
sheet.setColumnWidth(count,(headerName.length() + 1) * 512);
cell.setCellValue(headerName);
region=new CellRangeAddress(0,1,count,count);
sheet.addMergedRegion(region);
count++;
break;
}
}
}
}
return sheet;
}