poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominik Stadler <dominik.stad...@gmx.at>
Subject Re: java.lang.IllegalArgumentException: target is null for type http://schemas.openxmlformats.org/officeDocument/2006/relationships/h
Date Sat, 18 Mar 2017 09:31:32 GMT
Hi,

I tried to reproduce the problem with the snippets that you provided, but
unfortunately it worked for me without problem. So you probably need to
reduce your full code to a self-contained sample-code that runs standalone
but still shows the problem, otherwise it is hard to say how you end up
with the null-value at a place where it should not be possible according to
your sample-code.

Thanks... Dominik.

On Fri, Mar 17, 2017 at 6:37 AM, duanep026 <duanep026@gmail.com> wrote:

> My apologies Javen. Fileout is an the excel file which is in a directory.
>
> Hi Dominik. There are 2 columns in which I set hyperlinks. I will attach
> the
> code below for both columns.
>
> //WRep and WreturnLink are both strings.
>
> CreationHelper createHelper = wb.getCreationHelper();
> XSSFCellStyle hlinkStyle = (XSSFCellStyle) wb.createCellStyle();
> Font hlinkFont = wb.createFont();
>
> Column 1:
> cellDet = rowDet.createCell(7);
> cellDet.setCellValue(rsSelectionDet.getString("href"));
> if (!WReturnLink.equals("") && !WReturnLink.equals(null))  {
> //set up style to be able to create hyperlinks
> hlinkFont.setColor(IndexedColors.BLUE.getIndex());
> hlinkStyle.setFont(hlinkFont);
> link = createHelper.createHyperlink(HyperlinkType.URL);
> WRep = WReturnLink.substring(0, 150);
> link.setAddress(WRep);
> cellDet.setHyperlink(link);
> cellDet.setCellStyle(hlinkStyle);
> }
>
> Column 2:
> //set up style to be able to create hyperlinks
> hlinkFont.setColor(IndexedColors.BLUE.getIndex());
> hlinkStyle.setFont(hlinkFont);
> link = createHelper.createHyperlink(HyperlinkType.URL);
>
> //string for hyperlink
> WRep = "http://" + Wport.trim() + WBirtIp.trim() +
> "ORROR01R.rptdesign&__format=pdf&prod=" + Wprod.trim() + "&pC=" +
> String.valueOf(Company).trim() + "&pO=" +
> (rsSelectionGrnH.getString("gorder")).trim() +
> "&pL=" + Wcpage.trim() + ".JPG";
>
> cellDet = rowDet.createCell(13);
> cellDet.setCellValue(rsSelectionGrnH.getString("gorder"));
> link.setAddress(WRep);
> cellDet.setHyperlink(link);
> cellDet.setCellStyle(hlinkStyle);
>
> Thanks for your help Dominik.
>
> Regards,
> Duane
>
>
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.
> nabble.com/java-lang-IllegalArgumentException-
> target-is-null-for-type-http-schemas-openxmlformats-org-
> officeDoch-tp5726901p5726929.html
> Sent from the POI - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message