public static <T> void doWrite(List<Map<String, String>> maps, Class<T> clazz, OutputStream out)
            throws IOException {
        Field[] fields = clazz.getDeclaredFields();
        List<Pair<Field, ExcelField>> fieldMetas = extractFieldMetas(fields);
        if (fieldMetas.isEmpty()) {
            throw new IllegalArgumentException(
                    "At least one field must be marked as Excel Field by annotation @ExcelField in class " + clazz);
        }
        List<String> headNames = extractHeader(fieldMetas);
        try (XSSFWorkbook hwb = new XSSFWorkbook()) {
            // Set sheet name
            ExcelEntity excelEntity = clazz.getAnnotation(ExcelEntity.class);
            String sheetName = excelEntity.name();
            if (StringUtils.isBlank(sheetName)) {
                sheetName = DEFAULT_SHEET_NAME;
            }
            XSSFSheet sheet = hwb.createSheet(sheetName);
            // Set width of column
            for (int index = 0; index < fieldMetas.size(); index++) {
                Pair<Field, ExcelField> fieldMeta = fieldMetas.get(index);
                sheet.setColumnWidth(index, fieldMeta.getRight().style().width());
            }
            // Fill header with cellStyle
            List<XSSFCellStyle> headerStyles =
                    createContentCellStyle(hwb, fieldMetas, ExcelField::headerStyle, ExcelField::headerFont);
            fillSheetHeader(sheet.createRow(0), headNames, headerStyles);
            // Fill validation
            fillSheetValidation(sheet, fieldMetas, clazz.getCanonicalName());
            // Fill content if data exist.
            List<XSSFCellStyle> contentStyles =
                    createContentCellStyle(hwb, fieldMetas, ExcelField::style, ExcelField::font);
            if (CollectionUtils.isNotEmpty(maps)) {
                fillSheetContent(sheet, headNames, maps, contentStyles);
            } else {
                fillEmptySheetContent(sheet, headNames.size(), contentStyles);
            }
            hwb.write(out);
        }
        out.close();
        LOGGER.info("Database export succeeded");
    }
Writes the given content to an Excel document.

@param contents the list of contents to write
@param out      the output stream to write to
@throws IOException if there is an error writing to the output stream
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/tool/excel/ExcelTool.java