Write a Comment object to a worksheet
writeComment(wb, sheet, col, row, comment, xy = NULL)
A workbook object
A vector of names or indices of worksheets
Column a column number of letter
A row number.
A Comment object. See createComment()
.
An alternative to specifying col
and
row
individually. A vector of the form
c(col, row)
.
wb <- createWorkbook()
addWorksheet(wb, "Sheet 1")
c1 <- createComment(comment = "this is comment")
writeComment(wb, 1, col = "B", row = 10, comment = c1)
s1 <- createStyle(fontSize = 12, fontColour = "red", textDecoration = c("BOLD"))
s2 <- createStyle(fontSize = 9, fontColour = "black")
c2 <- createComment(comment = c("This Part Bold red\n\n", "This part black"), style = c(s1, s2))
c2
#> Author:
#> Text:
#> This Part Bold red
#>
#> This part black
#>
#> Style:
#> Font size: 12
#> Font colour: #FF0000
#> Font decoration: BOLD
#>
#>
#> Font size: 9
#> Font colour: #000000
#>
#>
writeComment(wb, 1, col = 6, row = 3, comment = c2)
if (FALSE) { # \dontrun{
saveWorkbook(wb, file = "writeCommentExample.xlsx", overwrite = TRUE)
} # }