how to mark color on csv file

G

Gavin Chen

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.
 
P

Phillip Gawlowski

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/

--=20
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.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Leibnitz
 
G

Gavin Chen

Phillip Gawlowski wrote in post #1001125:
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?
 
P

Phillip Gawlowski

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.

--=20
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.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Leibnitz
 
B

Bala TS

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top