【发布时间】:2021-05-24 09:21:49
【问题描述】:
我想为 DT 表输出设置行常量或固定的高度。对于下表,您可以看到行高的差异。
所以这种情况是当字符数增加时,例如在这种情况下,在第一个列中的第二行,那么所有行的高度都应该调整为相同。
df <- data.frame(`quote` = c("the trader belongs to","trader have long ralationship withthe same market with my opinion on thaw its implemented mmnnhhh sdfghj fghj kjhgf tyui cvbnm",
"types of trads happens everytime when market slow","trades have leverage with",
"market is continious with the same platform trades"),
`share`= c(43,65,92,23,73),
`times` = c(86,98,55,12,08),
`parts`=c(4,7,4,8,3))
df<-datatable(df,
options = list(columnDefs =
list(list(className = 'dt-center',
targets = "_all"))),rownames = FALSE)
df
就像在 flextable 中一样,我可以执行以下操作,但要为 DT 表寻找固定解决方案或任何功能。
(ncols %in% c(4,5)) {
fl<-width(flxtable, width = d*0.3, j = 1)
fl<-width(flxtable, width = (d*0.7)/(ncols-1), j = 2:ncols)
d is left and right margin of docs template
【问题讨论】: