You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2015/03/30 15:50:44 UTC

[Bug 57780] New: Exception java.lang.IllegalArgumentException when calling XSSFRichTextString#applyFont on XSSFRichTextString containing text string like _xNNNN_

https://bz.apache.org/bugzilla/show_bug.cgi?id=57780

            Bug ID: 57780
           Summary: Exception java.lang.IllegalArgumentException when
                    calling XSSFRichTextString#applyFont on
                    XSSFRichTextString containing text string like _xNNNN_
           Product: POI
           Version: 3.8-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: carlo.dellacqua@ext.piksel.it

Created attachment 32622
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32622&action=edit
Test classes and description of the results

We use POI 3.8-Final but the problem occurs also with 3.11.
We need the insert in cell comments strings with different font type and the
code used is the following:

XSSFWorkbook workbook = new XSSFWorkbook();

XSSFFont font = workbook.createFont();
font.setFontName("Verdana");
font.setFontHeightInPoints((short)14);
font.setBoldweight((short)700);
font.setColor(IndexedColors.BLUE.getIndex());

XSSFCreationHelper creationHelper = workbook.getCreationHelper();     
XSSFSheet sheet = workbook.createSheet();
XSSFDrawing drawing = sheet.createDrawingPatriarch();     
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 2, 2, 5, 5); 

XSSFRow row_0 = sheet.createRow(0);

XSSFCell cell_0_0 = row_0.createCell(0);
cell_0_0.setCellValue("Cell 0:0");
XSSFComment comment_0_0 = drawing.createCellComment(anchor);
XSSFRichTextString rts_0_0 = creationHelper.createRichTextString("RichString
0:0 _x0046_");
try {
    rts_0_0.applyFont(font);
} catch(java.lang.IllegalArgumentException iae) {
    System.out.println("testXSSF: Comment 0:0 - "+iae);
}
comment_0_0.setString(rts_0_0);
cell_0_0.setCellComment(comment_0_0);

and 
rts_0_0.applyFont(font);
returns the Exception.

To avoid the Exeception we have capitalized the text changing it from _x0046_
to _X0046_ (using Pattern/Matcher).

Has to be noticed that HSSF (file extension .xls) manages without problem the
text string.

Attached you can find a test class (Text_xNNNN_applyFont) and the created Excel
files.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57780] Exception java.lang.IllegalArgumentException when calling XSSFRichTextString#applyFont on XSSFRichTextString containing text string like _xNNNN_

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57780

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 OS|                            |All
         Resolution|---                         |DUPLICATE

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I think this is basically a duplicate of bug 57008, which we closed as WONTFIX,
see the comments further down in that bug for some explanation.

*** This bug has been marked as a duplicate of bug 57008 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org