Fix a potential bug in column/row spec
diff --git a/R/column_spec.R b/R/column_spec.R
index 1a07910..2e78586 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -148,6 +148,9 @@
border_left, border_right,
border_l_css, border_r_css,
extra_css) {
+ if (is.na(xml_attr(target_cell, "style"))) {
+ xml_attr(target_cell, "style") <- ""
+ }
if (!is.null(width)) {
xml_attr(target_cell, "style") <- paste0(xml_attr(target_cell, "style"),
"width: ", width, "; ")
diff --git a/R/row_spec.R b/R/row_spec.R
index 76d7fbd..47832eb 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -122,6 +122,9 @@
xml_cell_style <- function(x, bold, italic, monospace,
underline, strikeout, color, background,
align, font_size, angle, extra_css) {
+ if (is.na(xml_attr(x, "style"))) {
+ xml_attr(x, "style") <- ""
+ }
if (bold) {
xml_attr(x, "style") <- paste0(xml_attr(x, "style"),
"font-weight: bold;")