【发布时间】:2014-10-06 08:57:12
【问题描述】:
我有以下问题
我使用新库 openxlsx 将数据从 R 导出到 Excel。代码是这样的
mystyle = createStyle(fontName="Arial",fontSize=8,halign="right",wrapText=TRUE)
excel_export = function(wb,sheet,data,mystyle){
addWorksheet(wb,sheet,gridLines=FALSE)
#setRowHeights(wb,sheet,rows=1:nrow(data),heights=rep(0.13,nrow(data)))
addStyle(wb,sheet,mystyle,rows=1:nrow(data),cols=1:ncol(data),gridExpand=TRUE)
pageSetup(wb,sheet,orientation="landscape",scale=80,left=0.25,right=0.25,top=0.25,bottom=0.25)
writeDataTable(wb,sheet,data,xy=c(2,2),colNames=TRUE,rowNames=TRUE,tableStyle="TableStyleMedium9",withFilter=FALSE)
}
excel_export(wb,"Statics",dg,mystyle,0.8,20)
当我这样做时,我在 Excel 中收到以下错误消息:
<removedPart>removed part: /xl/tables/table3.xml-Part with XML-Error. (Sheet) A attribute must not contain '<' enthalten. Row 1,
Column 133.</removedPart>
(我将这条错误消息从德语翻译成英语)。
我使用的是 Excel 2010,64 位版本和 R 3.1.1。语言设置为德语。
【问题讨论】: