Source language: Translate to:

CSV FIle, Colored Cells ?

General questions about NeoBook

Moderator: Neosoft Support

CSV FIle, Colored Cells ?

Postby TMcD » Sun Dec 21, 2014 8:49 pm

I'm looking to output a CSV file and I wanted to color some cells.

So far have not been able to find how I need to output the file information from NeoBook.. example:

testcsv.csv
A1="This Cell is Blue"+{BLUE},A2="This cell has no color",A3="This cell is red"+{RED}

Or if anyone knows what kind of headers to write to create a .XLS, .XLSX file that'd be great.

I'm creating a NeoBook app that generates all the data and I'd like the cells to be colored upon opening it instead of doing it by hand. The calculations and coloring all done by NeoBook. The coloring will signify certain things and to go and do it by hand afterwards would be crazy. :shock:

Thanks for any guidance.

Troy
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: CSV FIle, Colored Cells ?

Postby Gaev » Sun Dec 21, 2014 10:17 pm

Troy:

1) Will the data be imported into a Microsoft Excel Spreadsheet or a Google Spreadsheet ?

2) What kind of spreadsheet size are you looking at ? ... Number of Rows by Columns ?

3) I have not used Excel in a long time ... but with Google Sheets, you can setup (javascript like) scripts to scan through every cell ... and set its attributes (like text color).

So, you should be able to pass required information ...

a) either as part of the cell text e.g.

"{BLUE}This Cell is Blue","{noColor}This cell has no color","{RED}This cell is red"

... and have the script ...

- extract the {color definitions}
- invoke the corresponding color instructions
- remove the color definitions

b) or as data imported in other columns e.g.

"This Cell is Blue","This cell has no color","This cell is red",BLUE,noColor,RED

... and have the script ...

- read the {color definitions} from cells in seaparate columns of the same row
- invoke the corresponding color instructions
- remove/hide the color definitions

b) or as data imported in a corresponding csv that is loaded into a second sheet whose cells contain only the color values e.g

data.csv = "This Cell is Blue","This cell has no color","This cell is red"
color.csv = BLUE,noColor,RED

... and have the script ...

- read the {color definitions} from cells in same columns/rows of the the color sheet
- invoke the corresponding color instructions
- (optionally) erase the color sheet

4) However, if there is logic used to determine the "color" for a "value or range of values" for a cell, similar logic can be built with the script in the Google Sheet ... hence the color values need not be imported each time with the data.

Can you give examples of the logic used to determine the "color" for a "value or range of values" for a "cell or range of cells" ?
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: CSV FIle, Colored Cells ?

Postby TMcD » Mon Dec 22, 2014 12:05 am

Wow Gaev! :shock:

Thanks for asking such detail.

I plan on using Excel and I'm not sure of how many exact columns and rows, but roughly say like 10 columns by (up to 50 rows).

I just planned on taking it easy, as in:

Write each row as I need (which would form the columns as well).

I just want to have NeoBook do the calculations and then determine if a cell needs to be a color or not. (Basically it would be a dumb spreadsheet.)

Thanks.

* I did subsequently read the .CSV files cannot/do not hold any coloring data/information.
TMcD
 
Posts: 237
Joined: Sun Apr 10, 2005 11:20 am

Re: CSV FIle, Colored Cells ?

Postby MiNeoBook » Mon Dec 22, 2014 8:20 am

This link maybe help. I work with this library two years ago.

http://excelbuilderjs.com/
MiNeoBook
 
Posts: 7
Joined: Mon Dec 08, 2014 9:40 am

Re: CSV FIle, Colored Cells ?

Postby Gaev » Mon Dec 22, 2014 11:05 am

Troy:

I plan on using Excel and I'm not sure of how many exact columns and rows, but roughly say like 10 columns by (up to 50 rows).

I recently uploaded a csv file to a Google Sheet ... 4,000 rows, each with 11 columns ... and used Google Script to change the Font Size of the cells ... so the output to a PDF file would show 64 lines per A4 page ... took about 10 seconds to change the Font Size.

So, the number of cells to be iterated (looped) in your case is very reasonable.

Since I have not used Excel in decades, I can not assist you with its scripting capabilities (VBA) ... but in a pinch, you can consider ...

- uploading the csv to a Google Sheet
- doing the color coding
- downloading it (as xls or xlsx)
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron