0
votes

I need to help with command "Ant clean all". I will try build one application of SAP Hybris, but, one class return de errors in to lines:

BOLDWEIGHT_BOLD cannot be resolved or is not a field

method with error:

@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
Please share the import for Font. Is is a library? Where did you put the library? Is it in the respective extensions lib folder or in a dependent extensions lib folder?Johannes Nolte
What is the version of POI library that you are using? 1) make sure you have imported correct package of Font interface 2) Try font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD) 3) If you are using the newer version of API then try font.setBold(true) docHybrisHelp

1 Answers

0
votes

Your maven version having issue with the one Font interface you are accessing. You imported the wrong path of Font interface.

Check your Font interface contains BOLDWEIGHT_BOLD attribute or not ?

I have my Font interface at org.apache.poi.ss.usermodel.Font location.