Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7437623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:25:42+00:00 2026-05-29T10:25:42+00:00

I have a Classic ASP script that outputs an HTML table as an XLS

  • 0

I have a Classic ASP script that outputs an HTML table as an XLS file but have had no luck getting a carriage return/line feed to work within a single cell.

For testing I am using code based on Kristof’s response to How to output an Excel *.xls file from classic ASP

I’ve tried every method I know of for inserting a carriage return/line feed. My sample code is as follows:

<%@ Language=VBScript %>
<%  Option Explicit
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=excelTest.xls"
%>
<table border="1">
    <tr>
        <td>Line1<br />Line2</td>
        <td><p>Line1</p>Line2</td>
        <td><div>Line1</div>Line2</td>
        <td>Line1<%=chr(10)%>Line2</td>
        <td>Line1<%=vbCR%>Line2</td>
        <td>Line1<%=vbLF%>Line2</td>
        <td>Line1<%=vbCRLF%>Line2</td>
        <td>Line1\rLine2</td>
        <td>Line1\nLine2</td>
    </tr>
</table>

I am opening the XLS in Excel 2010. The first 3 examples using HTML tags show the carriage return but split the data across 2 rows. The rest of the examples show the data on one line. Is there any way to populate an Excel field using Classic ASP with a carriage return without it splitting into multiple rows?

EDIT:

To clarify, I am trying to replicate the behavior of typing alt-enter within a cell in Excel. In the screenshot below you can see that the first 3 examples are splitting the data into two cells (rows 1 & 2) while the rest all appear on one line. I am trying to achieve two lines of text in one cell. Is there any other code I can use to insert a line break but keep the data in one cell?

Excel Screenshot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:25:42+00:00Added an answer on May 29, 2026 at 10:25 am

    Is there is some confusion between the display of mark-up and output of carriage returns in your code.

    The markup display gives the appearance of carriage returns for the first three td’s

    enter image description here

    and the fourth, sixth and seventh td’s contain carriage returns in the html source

    enter image description here

    EDIT asp per comment and screenshot supplied

    Add the following style to your page and you can see the first cell behaving as desired.

    <style>
    <!--table
    br {mso-data-placement:same-cell;}
    tr {vertical-align:top;}
    -->
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an ASP Classic script that runs every 15 minutes (via scheduled
I have a configuration file that i would like to update with classic asp.
I have created a small classic asp file that I indend to call form
I have some VB script in classic ASP that looks like this: if (x
We have a classic ASP application that simply works and we have been loathe
I have a classic ASP application which inserts some values into a word file
NET and VB.net code behind. I have a classic ASP page that connects to
I have a large classic ASP app that I have to maintain, and I
I have the following shortened classic ASP code that makes a SQL insert call...
I have a 200+ case statement in Classic ASP which is getting out of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.