找回密码
 注册
查看: 867|回复: 0

R语言 XLConnect包 addImage-methods()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-1 23:19:16 | 显示全部楼层 |阅读模式
addImage-methods(XLConnect)
addImage-methods()所属R语言包:XLConnect

                                        Adding images to a worksheet
                                         将图像添加到工作表

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Adds an image to a worksheet using a named region.
将图像添加到工作表中使用一个命名区域。


用法----------Usage----------


## S4 method for signature 'workbook'
addImage(object, filename, name, originalSize)



参数----------Arguments----------

参数:object
The workbook to use
workbook使用


参数:filename
Name of the image file. Supported are images of  the following formats: JPG/JPEG, PNG, WMF, EMF, BMP, PICT.
图像文件的名称。支持以下格式:JPG / JPEG,PNG,WMF,EMF,BMP,PICT图像。


参数:name
Name of the named region that the image is set to
命名区域的名称的图像被设置为


参数:originalSize
If originalSize = TRUE, the image is inserted in the top left corner of the named region and not scaled. Otherwise, the image is scaled to fit the named region. The default value for originalSize is FALSE.
如果originalSize = TRUE,图像被插入在命名区域左上角和不进行缩放。否则,图像缩放,以适应命名的区域。 originalSize的默认值是FALSE。


注意----------Note----------

There is an known issue in Apache POI with adding images to xls workbooks. The result of adding images to workbooks that already contain shapes or images may be that previous images are removed or that existing images are replaced with newly added ones. It is therefore advised that you use the addImage functionality only with workbooks that have no existing shapes or images. Note that this only holds for xls workbooks (Excel 97-2003) and not for xlsx (Excel 2007+). There should be no issues with xlsx workbooks.
在Apache POI将图像添加到XLS工作簿中有一个已知的问题。将图像添加到工作簿中已包含的形状或图像的结果可能是以前的图像被删除或取代现有的图像与新加入的。因此建议您使用addImage功能,只用有没有现成的图形或图像的工作簿。请注意,这仅持有XLS工作簿(Excel 97-2003年),而不是为XLSX(Excel 2007中+)。应该是没有问题的xlsx工作簿中。


(作者)----------Author(s)----------



Martin Studer<br>
Mirai Solutions GmbH <a href="http://www.mirai-solutions.com">http://www.mirai-solutions.com</a>




参见----------See Also----------

workbook, createName
workbook,createName


实例----------Examples----------


## Write an R plot to a specified named region[#写一个R图到指定的命名区域]
## This example makes use of the 'Tonga Trench Earthquakes' example[#这个例子使用的汤加海沟地震的例子]

# Load workbook (create if not existing)[负载工作簿(如果不存在创建)]
wb <- loadWorkbook("earthquake.xlsx", create = TRUE)

# Create a sheet named 'earthquake'[创建一张名为“地震”]
createSheet(wb, name = "earthquake")

# Create a named region called 'earthquake' referring to the sheet[创建一个命名的区域被称为“地震”的表]
# called 'earthquake' [所谓的“地震”]
createName(wb, name = "earthquake", formula = "earthquake!$B$2")

# Create R plot to a png device[&#341;图创建一个png设备]
require(lattice)
png(filename = "earthquake.png", width = 800, height = 600)
devAskNewPage(ask = FALSE)

Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
update(trellis.last.object(),
       strip = strip.custom(strip.names = TRUE, strip.levels = TRUE),
       par.strip.text = list(cex = 0.75),
       aspect = "iso")

dev.off()

# Write image to the named region created above using the image's[写的图像,上面创建的图像的命名区域]
# original size; i.e. the image's top left corner will match the[原来的大小,即图像的左上角将匹配]
# specified cell's top left corner [指定单元格的左上角]
addImage(wb, filename = "earthquake.png", name = "earthquake",
         originalSize = TRUE)

# Save workbook (this actually writes the file to disk)[保存工作簿(这实际上是将文件写入到磁盘)]
saveWorkbook(wb)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-24 19:28 , Processed in 0.024569 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表