How to mark color on csv file

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.

On Thu, May 26, 2011 at 7:57 AM, Gavin C. [email protected] 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 G.

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

Phillip G. wrote in post #1001125:

On Thu, May 26, 2011 at 7:57 AM, Gavin C. [email protected] 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 G.

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?

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

On Thu, May 26, 2011 at 9:07 AM, Gavin C. [email protected] 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 G.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs