6

是否可以在指定行之后隐藏工作表中的所有行?

library("openxlsx")

# Create a workbook.
wb <- createWorkbook()

# Add a worksheet.
addWorksheet(wb, sheetName = "test", gridLines = FALSE)

# "Hide" all rows after row 37.
setRowHeights(wb, 1, 38:1048576, 0)

# Write workbook.
saveWorkbook(wb, "test.xlsx", overwrite = TRUE)

# inspect file size.
file.info("test.xlsx")
#              size isdir mode               mtime               ctime               atime exe
# test.xlsx 2621280 FALSE  666 2018-09-13 14:54:10 2018-09-13 14:54:07 2018-09-13 14:54:07  no

似乎效率很低,并且似乎使输出变得非常大(尝试在 Excel 中打开它时速度很慢)。我认为它没有隐藏它,实际上只是将行高更改为 0?

4

0 回答 0