Re: [R] how to export ".xls" file with colorful cells?

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Thu, 24 Jul 2008 08:28:46 -0500

on 07/23/2008 08:29 PM XinMeng wrote:
> Hi all: I wanna know how to expoort ".xls" file. And in the exported
> ".xls" file, how to set different cells with different color?
>
> Thanks a lot! My best.

You don't indicate what operating system you are using and that is important as most of the relevant R packages/functions are Windows specific.

If you are on Windows, then you might want to look at the xlsReadWrite CRAN package to address the basic process of creating Excel files. More information is available via the R Wiki here:

http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows

The being said, a quick review suggests that the packages do not offer any cell level formatting functions.

If you are looking to create formatted reports, I would urge you to consider looking at using R's Sweave package, which uses LaTeX to enable reproducible research. An alternative would be the odfWeave package, which enables you to create OpenOffice.org documents that can also then be saved as MS Office documents or printed to PDF files. For some ideas of how Sweave can be used, go here:

http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatReport

If you must stay with Excel (eg. job requires it) and want to automate such operations, and further, might be comfortable coding in Perl, you can look at the Spreadsheet::WriteExcel module on CPAN:

http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm

This module would provide for platform independent creation and cell level formatting of Excel files.

HTH, Marc Schwartz



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Jul 2008 - 13:31:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jul 2008 - 14:32:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive