You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Reactable导出HTML/PNG时顶部出现段落标记问题求助

问题:reactable导出HTML/PNG时顶部出现段落标记(pilcrow)

我首次使用reactable,现在遇到一个问题:制作的简单reactable在RStudio预览显示正常,但保存为PNG和HTML格式时,输出内容顶部会出现5个段落标记(pilcrow)。

截图说明

  • RStudio预览:表格正常显示,无多余标记
  • 实际输出:表格顶部带有5个段落标记

导出警告

导出过程中收到如下警告:

[WARNING] Deprecated: --self-contained. use --embed-resources --standalone

我测试了其他人的reactable代码,导出为HTML和PNG时也会出现相同的段落标记问题。

使用的代码

# Libraries
library(dplyr)
library(ggplot2)
library(tidyr)
library(reactable)
library(reactablefmtr)
library(utf8)
library(gt)
library(htmlwidgets)
library(webshot2)
webshot::install_phantomjs()

# data
Rank <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Name <-  c('Red Lion', 'Crown', 'Royal Oak', 'White Hart', 'Railway', 'Plough', 'Swan', 'White Horse', 'Kings Arm', 'Ship')
Number <-  c(519, 485, 406, 300,  280, 278, 276, 271, 237, 230)
Popular_Pub_Name <- data.frame(Rank, Name, Number)

# reactable
table <- reactable(Popular_Pub_Name,
                   defaultSorted = "Number",
                   width = 500,
                   defaultColDef = colDef(align = "left"),
                   columns = list(
                     Rank = colDef(
                       width = 60
                     ),
                     Name = colDef(
                       name = "Pub Name",
                       width = 100
                     ),
                     Number = colDef(
                       defaultSortOrder = "desc",
                       width = 200,
                       cell = data_bars(Popular_Pub_Name,
                                        fill_color="#7814ff",
                                        text_position = "outside-end",
                                        bar_height = 10,
                                        text_size = 12,
                                        min_value=0,
                                        max_value =600,
                                        background = "transparent"
                       )
                     )))

table1 <- table %>%
  add_title("UK's Most Popular Pub Name")

# output
html <- "pub_name1.html"
saveWidget(table1, html)

# save as png
webshot(html, "pub_name1.png", zoom = 3, vwidth = 500)

内容的提问来源于stack exchange,提问作者Wai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 11:21:07