didiaode18 opened a new issue, #10903:
URL: https://github.com/apache/dolphinscheduler/issues/10903

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   
![image](https://user-images.githubusercontent.com/22792154/178461062-6a35e588-76cc-47af-b631-2d1d03fb461e.png)
   When I set the alarm instance to attach or table attachement mode, I found 
that the alarm does not trigger
   
   ### What you expected to happen
   
   Able to receive alert emails
   
   ### How to reproduce
   
   When I debug remotely, I found that I jumped directly to finally when I 
walked to the annotation part of the screenshot.
   
![image](https://user-images.githubusercontent.com/22792154/178462468-86f6697c-ef54-49bd-9302-362384c54140.png)
   When I replace SXSSFWorkbook with HSSFWorkbook, the alarm can be triggered
   
   
   
   
   ### Anything else
   
    public static void genExcelFile(String content, String title, String 
xlsFilePath) {
           List<LinkedHashMap> itemsList;
   
           //The JSONUtils.toList has been try catch ex
           itemsList = JSONUtils.toList(content, LinkedHashMap.class);
   
           if (CollectionUtils.isEmpty(itemsList)) {
               logger.error("itemsList is null");
               throw new AlertEmailException("itemsList is null");
           }
   
           LinkedHashMap<String, Object> headerMap = itemsList.get(0);
   
           List<String> headerList = new ArrayList<>();
   
           for (Map.Entry<String, Object> en : headerMap.entrySet()) {
               headerList.add(en.getKey());
           }
   
           HSSFWorkbook wb = null;
           FileOutputStream fos = null;
           try {
               // declare a workbook
               wb = new HSSFWorkbook();
               // generate a table
               HSSFSheet sheet = wb.createSheet();
               HSSFRow row = sheet.createRow(0);
               //set the height of the first line
               row.setHeight((short) 500);
   
               //set Horizontal right
               CellStyle cellStyle = wb.createCellStyle();
               cellStyle.setAlignment(HorizontalAlignment.RIGHT);
   
               //setting excel headers
               for (int i = 0; i < headerList.size(); i++) {
                   HSSFCell cell = row.createCell(i);
                   cell.setCellStyle(cellStyle);
                   cell.setCellValue(headerList.get(i));
               }
   
               //setting excel body
               int rowIndex = 1;
               for (LinkedHashMap<String, Object> itemsMap : itemsList) {
                   Object[] values = itemsMap.values().toArray();
                   row = sheet.createRow(rowIndex);
                   //setting excel body height
                   row.setHeight((short) 500);
                   rowIndex++;
                   for (int j = 0; j < values.length; j++) {
                       HSSFCell cell1 = row.createCell(j);
                       cell1.setCellStyle(cellStyle);
                       cell1.setCellValue(String.valueOf(values[j]));
                   }
               }
   
               for (int i = 0; i < headerList.size(); i++) {
                   sheet.setColumnWidth(i, headerList.get(i).length() * 800);
               }
   
               File file = new File(xlsFilePath);
               if (!file.exists()) {
                   file.mkdirs();
               }
   
               //setting file output
               fos = new FileOutputStream(xlsFilePath + 
EmailConstants.SINGLE_SLASH + title + EmailConstants.EXCEL_SUFFIX_XLSX);
   
               wb.write(fos);
   
           } catch (Exception e) {
               throw new AlertEmailException("generate excel error", e);
           } finally {
               if (wb != null) {
                   try {
                       wb.close();
                   } catch (IOException e) {
                       logger.error(e.getMessage(), e);
                   }
               }
               if (fos != null) {
                   try {
                       fos.close();
                   } catch (IOException e) {
                       logger.error(e.getMessage(), e);
                   }
               }
           }
       }
   
   The above code can trigger the alarm
   
   ### Version
   
   2.0.5
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to