We help IT Professionals succeed at work.

Excel file result in ColdFusion, creating new lines

Medium Priority
281 Views
Last Modified: 2013-12-16
I have several coldfusion pages set up that provide me with an Excel file from the database.  On the most recent one that I set up, I ask for the entire database.  One of the problems is there are around 30 fields, and when it creates an Excel worksheet, it creates a second line to fill in half of the data.  I want all the fields to appear in one line.  I do have a #carriage# at the end of it, but is there a way to tell it not to return in the middle?
Comment
Watch Question

CERTIFIED EXPERT

Commented:
when I export to excel I use an HTML table to place the data into the rows and columns.   How are you doing it?

Do you have any line breaks in your data?  you may have to search for them and replace them

Author

Commented:
I have it all like this

#membertype##tab##location##tab##anniversary##tab#

I use the

<CFHEADER NAME="Content-Disposition" VALUE="inline; filename=myfile.xls">
<CFCONTENT TYPE="application/vnd.msexcel">

Can I use the table with cells, etc, and it will still come out as an excel sheet using the above commands?
CERTIFIED EXPERT
Commented:
> Can I use the table with cells, etc, and it will still come out as an excel sheet using the above commands?

Yes, a table with cells will work the same way.   It may help delimit if you have line breaks in your data

CERTIFIED EXPERT

Commented:
perhaps you can set #tab# = "</td><td>"
and add
<tr><td> to the start of the line
and
</td></tr>
to the end of the line

with, of course, <table> and </table> at both ends

for a test..

Author

Commented:
Exporting it as a table is great.  Only problem is that I need to set a style for date and currency fields:



The one big problem I have is data with a return in it. I have tried putting < BR > in the field, but it ends up making another line in Excel
CERTIFIED EXPERT

Commented:
If you're having some trouble, you should add a post with your issue rather than closing the question with a B grade.   Most experts are willing to see you through to a complete conclusion.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.