Re: How to select range

86 views
Skip to first unread message

Adrian Dragulescu

unread,
Mar 28, 2017, 8:30:42 AM3/28/17
to R-package-xlsx
I don't think you have cells[[1,6]].  You need to create it first.

Adrian




On Mar 28, 2017 3:47 AM, "Alexander Medvedevskikh" <ale...@gmail.com> wrote:
Hi!

I'm trying to set cell style to cells from 1 to 13 in first row using setCellStyle.

if I use: 
    
csSheetTitle <- CellStyle(wb) +
        Font(wb, heightInPoints = 12, isBold = TRUE) +
        Alignment(wrapText = TRUE, h = "ALIGN_CENTER") +
        Fill(backgroundColor = "lavender", foregroundColor = "lavender", pattern = "SOLID_FOREGROUND")      

setCellStyle(cells[[1,1]], csSheetTitle) 
setCellStyle(cells[[1,2]], csSheetTitle)
setCellStyle(cells[[1,3]], csSheetTitle)
setCellStyle(cells[[1,4]], csSheetTitle)
setCellStyle(cells[[1,5]], csSheetTitle)


it works Ok for the first 5 cells only, the first 5 cells in first row have a new style.

But it give me an error if I add another one cell:

setCellStyle(cells[[1,1]], csSheetTitle) 
setCellStyle(cells[[1,2]], csSheetTitle)
setCellStyle(cells[[1,3]], csSheetTitle)
setCellStyle(cells[[1,4]], csSheetTitle)
setCellStyle(cells[[1,5]], csSheetTitle)
setCellStyle(cells[[1,6]], csSheetTitle)

Error : subscript out of bounds

How do I select the cell range for using setCellStyle properly?

Thank you very much in advance!

--
You received this message because you are subscribed to the Google Groups "R-package-xlsx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-package-xlsx+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages