【问题标题】:BUILD FAILED SAP Hybris构建失败的 SAP Hybris
【发布时间】:2019-05-13 20:35:18
【问题描述】:

我需要帮助命令“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;
    }

【问题讨论】:

  • 请分享字体的导入。是图书馆吗?你把图书馆放在哪里了?它是在各自的扩展库文件夹中还是在依赖的扩展库文件夹中?
  • 您使用的 POI 库是什么版本的? 1) 确保你已经导入了正确的字体接口包 2) 试试font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD) 3) 如果你使用的是新版本的API,那么试试font.setBold(true) doc

标签: ant hybris


【解决方案1】:

您的 maven 版本与您正在访问的一个字体界面存在问题。您导入的字体界面路径错误。

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

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

【讨论】:

    猜你喜欢
    • 2020-08-19
    • 1970-01-01
    • 2023-03-31
    • 2022-11-10
    • 2022-08-10
    • 2017-03-31
    • 1970-01-01
    • 2021-08-18
    • 2020-06-01
    相关资源
    最近更新 更多