Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #5071 > unrolled thread
| Started by | Gavin Chen <dickyhide@gmail.com> |
|---|---|
| First post | 2011-05-26 00:57 -0500 |
| Last post | 2011-05-26 07:23 -0500 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.ruby
how to mark color on csv file Gavin Chen <dickyhide@gmail.com> - 2011-05-26 00:57 -0500
Re: how to mark color on csv file Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-05-26 01:23 -0500
Re: how to mark color on csv file Gavin Chen <dickyhide@gmail.com> - 2011-05-26 02:07 -0500
Re: how to mark color on csv file Phillip Gawlowski <cmdjackryan@googlemail.com> - 2011-05-26 02:26 -0500
Re: how to mark color on csv file Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 07:23 -0500
| From | Gavin Chen <dickyhide@gmail.com> |
|---|---|
| Date | 2011-05-26 00:57 -0500 |
| Subject | how to mark color on csv file |
| Message-ID | <6ae67f143353b6bb579035ae562a007f@ruby-forum.com> |
I can write/read the csv file by my ruby script. But how to mark color on the csv output content. Let it easy to read. -- Posted via http://www.ruby-forum.com/.
[toc] | [next] | [standalone]
| From | Phillip Gawlowski <cmdjackryan@googlemail.com> |
|---|---|
| Date | 2011-05-26 01:23 -0500 |
| Message-ID | <BANLkTikGvn=YnQeMjoRcUSV=hsMRb_Z1hg@mail.gmail.com> |
| In reply to | #5071 |
On Thu, May 26, 2011 at 7:57 AM, Gavin Chen <dickyhide@gmail.com> wrote: > I can write/read the csv file by my ruby script. > > But how to mark color on the csv output content. > > Let it easy to read. If you mean the console, take a look at: http://ascii85.rubyforge.org/ -- Phillip Gawlowski A method of solution is perfect if we can forsee from the start, and even prove, that following that method we shall attain our aim. -- Leibnitz
[toc] | [prev] | [next] | [standalone]
| From | Gavin Chen <dickyhide@gmail.com> |
|---|---|
| Date | 2011-05-26 02:07 -0500 |
| Message-ID | <255ac8d7c03f856927d2a3179a5caaa9@ruby-forum.com> |
| In reply to | #5072 |
Phillip Gawlowski wrote in post #1001125: > On Thu, May 26, 2011 at 7:57 AM, Gavin Chen <dickyhide@gmail.com> wrote: >> I can write/read the csv file by my ruby script. >> >> But how to mark color on the csv output content. >> >> Let it easy to read. > > If you mean the console, take a look at: http://ascii85.rubyforge.org/ > > -- > Phillip Gawlowski > > A method of solution is perfect if we can forsee from the start, > and even prove, that following that method we shall attain our aim. > -- Leibnitz Thanks, But not on the console. I parser some data and output file is .csv. On the csv file (open by excel) I want to use color to mark some cell. Does can work? -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Phillip Gawlowski <cmdjackryan@googlemail.com> |
|---|---|
| Date | 2011-05-26 02:26 -0500 |
| Message-ID | <BANLkTi=a9Lfpwck+ESLmCbZgkYN=dko-EQ@mail.gmail.com> |
| In reply to | #5073 |
On Thu, May 26, 2011 at 9:07 AM, Gavin Chen <dickyhide@gmail.com> wrote: > > On the csv file (open by excel) I want to use color to mark some > > cell. > > Does can work? No: http://tools.ietf.org/html/rfc4180#section-2 You'd've to create a spreadsheet for that, and maybe the spreadsheet gem can pull that off for you (I haven't used it). If you are certain that the Excel installation being used can read ODF files, you can try [Open|Libre]Office's spreadsheet format (Though, AFAIK, Excel versions before 2007 require a plugin for that), or create an Excel spreadsheet. -- Phillip Gawlowski A method of solution is perfect if we can forsee from the start, and even prove, that following that method we shall attain our aim. -- Leibnitz
[toc] | [prev] | [next] | [standalone]
| From | Bala TS <bdeveloper01@yahoo.com> |
|---|---|
| Date | 2011-05-26 07:23 -0500 |
| Message-ID | <4c86c0daa4e6b88041e63122c4348a06@ruby-forum.com> |
| In reply to | #5071 |
require 'fastercsv'
FasterCSV.parse(my_string, :headers => true) do |row|
Fruit.create!(
:name => row['name'],
:color => row['color'],
:tasty => row['tasty'] == 'true',
:qty => row['qty].to_i
)
end
For Ruby 1.9, just rename FasterCSV to CSV and fastercsv to csv:
require 'csv'
CSV.parse(my_string, :headers => true) do |row|
# same as ruby-1.8
end
so you must need fastercsv gem if you install then it is possible
bye
--
Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.ruby
csiph-web