cfsimplicity / spreadsheet-cfml

Standalone library for working with spreadsheets and CSV in CFML
MIT License
126 stars 35 forks source link

Use differents fonts, styles and size in a Cell #332

Closed sebviatour-iteamlu closed 1 year ago

sebviatour-iteamlu commented 1 year ago

Hello,

I used this library to create and extract some spreadsheet.

I would like to know if it's possible to mix differents fonts, styles and size in a Cell. Example : (bold, color: red) A1 (bold, color: dark) Test (bold, color: blue) to retrieve some datas.

Thanks for your help.

Best Regards

cfsimplicity commented 1 year ago

Hello

The library allows you to apply a range of formats to cells. The documentation explains the possible options:

https://github.com/cfsimplicity/spreadsheet-cfml/wiki/Formatting-options

You apply them as a struct using the appropriate formatting method, for example formatCell():

data = QueryNew( "First,Last","VarChar,VarChar",[ [ "Susi","Sorglos" ],[ "Frumpo","McNugget" ] ] );
spreadsheet = New spreadsheet();
workbook = spreadsheet.workbookFromQuery( data );
myFormat= { bold: "true", color: "red" };
spreadsheet.formatCell( workbook, myFormat, 1, 1 );

This just applies one format to one cell, but you can apply different formats to different cells.

sebviatour-iteamlu commented 1 year ago

Hello,

Thanks for your help.