@@ -883,15 +883,16 @@ write_data_table <- function(
883
883
}
884
884
885
885
# # If 0 rows append a blank row
886
- validNames <- c(" none" , paste0(" TableStyleLight" , seq_len(21 )), paste0(" TableStyleMedium" , seq_len(28 )), paste0(" TableStyleDark" , seq_len(11 )))
886
+ cstm_tableStyles <- rbindlist(xml_attr(wb $ styles_mgr $ styles $ tableStyles , " tableStyles" , " tableStyle" ))$ name
887
+ validNames <- c(" none" , paste0(" TableStyleLight" , seq_len(21 )), paste0(" TableStyleMedium" , seq_len(28 )), paste0(" TableStyleDark" , seq_len(11 )), cstm_tableStyles )
887
888
if (! tolower(tableStyle ) %in% tolower(validNames )) {
888
- warning (" Invalid table style." )
889
- } else {
890
- tableStyle <- grep(paste0( " ^ " , tableStyle , " $ " ), validNames , ignore.case = TRUE , value = TRUE )
891
- tableStyle <- tableStyle [ ! is.na( tableStyle )]
892
- if (length( tableStyle ) == 0 ) {
893
- warning( " Unknown table style. " )
894
- }
889
+ stop (" Invalid table style." )
890
+ }
891
+
892
+ tableStyle <- grep(paste0( " ^ " , tableStyle , " $ " ), validNames , ignore.case = TRUE , value = TRUE )
893
+ tableStyle <- tableStyle [ ! is.na( tableStyle )]
894
+ if (length( tableStyle ) == 0 ) {
895
+ stop( " Unknown table style. " )
895
896
}
896
897
897
898
# # If zero rows, append an empty row (prevent XML from corrupting)
0 commit comments