saveWorkbook-methods(XLConnect)
saveWorkbook-methods()所属R语言包:XLConnect
Saving Microsoft Excel workbooks
节能Microsoft Excel工作簿
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Saves a workbook to the corresponding Excel file. This method actually writes the workbook object to disk.
保存一个workbook到相应的Excel文件。这种方法实际上到磁盘写入workbook对象。
用法----------Usage----------
## S4 method for signature 'workbook,missing'
saveWorkbook(object,file)
## S4 method for signature 'workbook,character'
saveWorkbook(object,file)
参数----------Arguments----------
参数:object
The workbook to save
workbook保存
参数:file
The file to which to save the workbook ("save as"). If not specified (missing), the workbook will be saved to the workbook's underlying file which is the file specified in loadWorkbook (also see the workbook class for more information). Note that due to currently missing functionality in Apache POI, workbooks can only be saved in the same file format - i.e. if the workbooks underlying file format is xls, then the file argument may only specify another xls file. Also note that when specifying the file argument the workbook's underlying filename changes to reflect the "save as" behavior.<br> Paths are expanded using path.expand.
文件保存workbook(“另存为”)。如果没有指定(失踪),该工作簿将被保存到workbook的相关文件,该文件中指定的文件loadWorkbook(也看到了workbook类信息)。注意的是,由于目前缺少的功能在Apache POI,工作簿只能保存在相同的文件格式 - 即如果相关的工作簿文件格式是XLS,然后file参数只可指定其他xls文件。还要注意的是时file指定参数workbook的基本文件名更改,以反映“另存为”的行为。<BR>路径扩大使用path.expand,。
Details
详细信息----------Details----------
Saves the specified workbook object to disk.
指定的workbook对象保存到磁盘上。
注意----------Note----------
As already mentioned in the documentation of the workbook class, a workbook's underlying Excel file is not saved (or being created in case the file did not exist and create = TRUE has been specified) unless the saveWorkbook method has been called on the object. This provides more flexibility to the user to decide when changes are saved and also provides better performance in that several changes can be written in one go (normally at the end, rather than after every operation causing the file to be rewritten again completely each time). This is due to the fact that workbooks are manipulated in-memory and are only written to disk with specifically calling saveWorkbook.<br><br> Further note that calling saveWorkbook more than once leads to an exception. This is due to a current issue in the underlying POI libraries. However, with XLConnect there should be no need to call saveWorkbook more than once so virtually this is no issue.
正如前面提到的文档中的workbook类,workbook的基本Excel文件不会被保存(或文件不存在的情况下创建和create = TRUE已指定)除非saveWorkbook方法被调用的对象。这提供了更大的灵活性,用户来决定何时更改将被保存,也可以写在一个(通常在年底,而不是每次操作后导致文件被完全重新改写,每次在这几个变化提供了更好的性能) 。这是由于这样的事实:被操纵的工作簿,在内存中,并且只写入到磁盘中,与具体呼叫saveWorkbook。<BR> <BR>的进一步注意,调用saveWorkbook不止一次导致异常。这是由于底层POI库中的电流的问题。然而,XLConnect应该没有需要调用saveWorkbook不止一次实际上,这是没有问题。
(作者)----------Author(s)----------
Martin Studer<br>
Mirai Solutions GmbH <a href="http://www.mirai-solutions.com">http://www.mirai-solutions.com</a>
参见----------See Also----------
workbook, loadWorkbook
workbook,loadWorkbook
实例----------Examples----------
# Create a new workbook 'saveMe.xlsx'[创建一个新的工作簿saveMe.xlsx“]
# (assuming the file to not exist already)[(假设文件不存在)]
wb <- loadWorkbook("saveMe.xlsx", create = TRUE)
# Create a worksheet called 'mtcars'[创建一个工作表被称为“mtcars]
createSheet(wb, name = "mtcars")
# Write built-in dataset 'mtcars' to sheet 'mtcars' created above[写内置数据集的mtcars上面创建的表“mtcars]
writeWorksheet(wb, mtcars, sheet = "mtcars")
# Save workbook - this actually writes the file 'saveMe.xlsx' to disk[保存工作簿 - 这实际上是该文件的写入saveMe.xlsx到磁盘]
saveWorkbook(wb)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|