建立失败的SAP Hybris

时间:2018-12-12 17:12:17

标签: ant hybris

我需要帮助执行命令“ Ant clean all”。我将尝试构建一个SAP Hybris应用程序,但是,一个类在行中返回错误:

BOLDWEIGHT_BOLD无法解析或不是字段

错误方法:

@Override
    public HSSFWorkbook createMDDExportFile(final List<JnJProductModel> products, final String fileName)
    {
        final String METHOD_NAME = "createMDDExportFile()";
        LOGGER.info("JnJGTProductService" + Logging.HYPHEN + METHOD_NAME + Logging.HYPHEN + "Start of the method");
        catalogVersionService.setSessionCatalogVersion(Jnjb2bCoreConstants.MDD_CATALOG_ID, Jnjb2bCoreConstants.ONLINE);
        final String sheetName = "MDD_Products_Sheet_0";
        final HSSFWorkbook excelWorkBook = new HSSFWorkbook();

        final HSSFFont font = excelWorkBook.createFont();
ERROR=> font.setBoldweight(Font.BOLDWEIGHT_BOLD);

        final HSSFCellStyle style = excelWorkBook.createCellStyle();
        style.setFont(font);
        final HSSFSheet sheet = excelWorkBook.createSheet(sheetName);

        sheet.autoSizeColumn(0);
        final HSSFRow downloadDateHeader = sheet.createRow(0);
        downloadDateHeader.createCell(0).setCellValue("Download date");
        downloadDateHeader.getCell(0).setCellStyle(style);

        final String currentTime = new Date().toString();
        downloadDateHeader.createCell(1).setCellValue(currentTime);

        /*
         * final HSSFRow globalAccounHeader = sheet.createRow(1);
         * globalAccounHeader.createCell(0).setCellValue("Global Account Name");
         * globalAccounHeader.getCell(0).setCellStyle(style);
         * globalAccounHeader.createCell(1).setCellValue(currentAccount);
         */
        try
        {
            final String filepath = Config.getParameter(Jnjb2bCoreConstants.EXPORT_EMAIL_ATTACHMENT_PATH_KEY) + File.separator
                    + fileName;
            createMDDExcelFile(products, sheet, excelWorkBook, style, filepath);
            final File file = new File(filepath);
            createMedia(file);
        }
        catch (final Exception exception)
        {
            LOGGER.error("There was an error while trying to create the excel file for the catalog export", exception);
        }
        LOGGER.info("JnJGTProductService" + Logging.HYPHEN + METHOD_NAME + Logging.HYPHEN + "End of the method");
        return excelWorkBook;
    }

1 个答案:

答案 0 :(得分:0)

您的Maven版本在您访问的一个Font界面上有问题。您导入了Font接口的路径错误。

检查您的字体界面是否包含 BOLDWEIGHT_BOLD 属性?

我的字体界面位于 org.apache.poi.ss.usermodel.Font 位置。