R: rJava error with xlsx (0.4.2) package

怎甘沉沦 提交于 2019-12-24 00:09:39

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/11300647/r-rjava-error-with-xlsx-0-4-2-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!