Solved

Wrap text in Excel

Posted on 2004-08-14
11
902 Views
Last Modified: 2007-12-19
Hi,

I am generating an Excel sheet pragramatically. Please let me know how can I wrap the text in Excel cell. Presently, if the text is more, it is coming in one line, without wrapping.

Waiting for reply.
Regards,
R  S
0
Comment
Question by:rajneetbhatia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
11 Comments
 
LVL 15

Expert Comment

by:Colosseo
ID: 11799745
Hi R S

You can wrap the text in a cell by setting the .WrapText property of the cell to True

so for example

Range("A1").WrapText = True

Regards

Scott
0
 

Author Comment

by:rajneetbhatia
ID: 11799782
Hi Scott,

In my case, I am not giving name to a range. How can I use it without range?

Thanks,
R S
0
 
LVL 15

Accepted Solution

by:
Colosseo earned 20 total points
ID: 11799788
Hi R S

There are several ways you can do this... two more exampes are:

ActiveCell.WrapText = True
Selection.WrapText = True

how are you referencing cells when you output to them?

Scott
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rajneetbhatia
ID: 11799811
Hi Scott,

I am generating Excel programatically based on the data in the database. If the data is more, it is wrapping in HTML(browser), but when I export it to excel, it is coming in same line.

I want to have the data in excel in the same way as it is coming in word or browser. If you want I can give a name to the TD.

Thanks,
R S
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11799816
Hi  R S

I think it would help if you could post the code you are using to generate the excel. From there we can see what you are doing and how best to help.

Regards

Scott
0
 
LVL 10

Expert Comment

by:daleoran
ID: 11801224
Not sure if this is what you need but ...

Highlight the cells, then
Format > cells
Click the 'alignment' tab
click 'Wrap text'

Michael

0
 

Author Comment

by:rajneetbhatia
ID: 11838186
"I think it would help if you could post the code you are using to generate the excel. From there we can see what you are doing and how best to help.
"

Hi,

I am writing following two lines in my java code, which asks me to open or save in excel, and thus I am able to save my html generated code into excel.

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment;filename=a.xls");

Thanks,
R S
0
 
LVL 9

Expert Comment

by:cwolves
ID: 11903576
put the content in quotes if it's a CSV:

"this content
should wrap
in excel"

if you're using html, use "<BR>" tags instead of linebreaks.

or use chr(10) or chr(13) instead of linebreaks
0
 
LVL 9

Expert Comment

by:cwolves
ID: 12810659
sample:

<table>
<tr>
<td style="height:100%;width:50px;">test
test
test
test
test<br />
</td>
</tr>
</table>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS Style on Chrome 1 57
links not working 2 35
Search Box CSS Question 16 50
Set a parameter in a properties file and use in html table. 14 60
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question