1

We are working with cfspreadsheet and have a data sheet from a client which contains content that spans multiple lines in one particular cell. Some of the content has formatting applied so some content is bold and some other content spans multiple lines.

What I'm wondering is... is there any way with cfspreadsheet to handle the content that is on multiple lines and preserve the formatting when its imported into our database ? IE keep the text bold and the line breaks ? Or is this something that will require regular expressions to handle it ?

thanks in advance

Leigh
  • 28,765
  • 10
  • 55
  • 103
user125264
  • 1,809
  • 2
  • 27
  • 54
  • If you read the contents of a cell with carriage returns into a variable and then write it back to the cell, what happens? – Dan Bracuk Oct 29 '13 at 09:58

1 Answers1

0

You should not need to do anything special to handle multi-line cell values. Any line breaks within a cell are represented as chr(10). To display them in an html page, simply replace chr(10) with an html line break:

#replace( theImportedCellValue, chr(10), "<br>", "all")#

As far as formatting, you cannot extract cell formatting information with any of the built in tags or functions. You would need to use the underlying POI library to extract that information. Keep in mind, spreadsheets do not store formatting as html. So it would require some low level code to translate it into html terms <b> or <strong>

The overall process would involve looping through the individual cells, and grabbing the RichTextString object for each one. Then looping through all of the object's "formatting runs" to determine where the bold text starts and ends.

Community
  • 1
  • 1
Leigh
  • 28,765
  • 10
  • 55
  • 103