简体   繁体   English

R openxlsx Excel导出:XML错误

[英]R openxlsx Excel Export: XML Error

I have the following problem 我有以下问题

I export data from R to Excel with the new library openxlsx . 我使用新的库openxlsx将数据从R导出到Excel。 The code looks like this 代码看起来像这样

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)

When I do so, I get in Excel the following error message: 这样做时,我在Excel中收到以下错误消息:

<removedPart>removed part: /xl/tables/table3.xml-Part with XML-Error. (Sheet) A attribute must not contain '<' enthalten. Row 1,
Column 133.</removedPart>

(I translated this error message from German into English). (我将此错误消息从德语翻译成英语)。

I am using Excel 2010, 64 bit version and R 3.1.1. 我正在使用64位版本的Excel 2010和R 3.1.1。 Language is set to German. 语言设置为德语。

I used to receive this error regularlly. 我以前经常收到此错误。 I checked all my data/results in both R and Excel and noticed no missing data. 我在R和Excel中都检查了所有数据/结果,发现没有数据丢失。 I investigated a bit more on StackOverflow, Google, and IRC and the conclusion that I came to was that this message can be ignored. 我对StackOverflow,Google和IRC进行了更多研究,得出的结论是可以忽略此消息。

Please inspect your source and destination data. 请检查您的源数据和目标数据。 You should be able to confirm that there is no missing data and if so then you can ignore the XML error. 您应该能够确认没有丢失的数据,如果是这样,则可以忽略XML错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM