wb <- wb_workbook()
wb$add_worksheet("Sheet 1")
# write comment without author
c1 <- create_comment(text = "this is a comment", author = "")
write_comment(wb, 1, col = "B", row = 10, comment = c1)
# Write another comment with author information
c2 <- create_comment(text = "this is another comment", author = "Marco Polo")
write_comment(wb, 1, col = "C", row = 10, comment = c2)
# write a styled comment with system author
s1 <- create_font(b = "true", color = wb_colour(hex = "FFFF0000"), sz = "12")
s2 <- create_font(color = wb_colour(hex = "FF000000"), sz = "9")
c3 <- create_comment(text = c("This Part Bold red\n\n", "This part black"), style = c(s1, s2))
write_comment(wb, 1, col = 6, row = 3, comment = c3)
# remove the first comment
remove_comment(wb, 1, col = "B", row = 10)
Run the code above in your browser using DataLab