Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: rJava error with xlsx (0.4.2) package

I am trying to use the xlsx package to fill a spreadsheet with information from an external file. Up until now, I have used addDataFrame() to put information into the spreadsheet, and everything about it that I have tried has been successful (fonts, colors, borders, etc.)

The issue now is that I need to have a column of hyperlinks, and to do that I need to get or create the specific cells (I'm not sure which, and both give the same error). The following code:

library(xlsx)
wb = createWorkbook(type="xlsx")
sheet = createSheet(wb, sheetName="InProduction")
createCell(1, 2)

Produces the error:

Error in .jcall(row[[ir]], "Lorg/apache/poi/ss/usermodel/Cell;", "createCell", : RcallMethod: cannot determine object class

After doing some poking around, I found the method it is trying to call is from this API with the call:

minColIx <- .jcall(row[[ir]], "T", "getFirstCellNum")

Which seems to me like it ought to work, but it clearly doesn't. Can anyone shed some light on this?

Thanks in advance!

like image 560
KritSandvich Avatar asked Aug 04 '26 18:08

KritSandvich


1 Answers

You need to create rows using createRow or getRows before you can create cells in these rows using createCells.

like image 83
flodel Avatar answered Aug 07 '26 07:08

flodel