From ASP I create response, which is to be shown as an Excel worksheet in
the user's browser (by setting the ContentType and creating a table). This
works fine.

Does anybody know what to do, if one of the cells should contain a multiline
text? I already tried by inserting a <br> inside the <td>. But this won't
work.

--
Michael G. Schneider
MTLookup http://www.mtlookup.com
Movable Type Weblog http://www.movable-type-weblog.com/

Re: Creating an Excel file from ASP and setting a LineFeed by Bob

Bob
Fri Oct 21 06:21:11 CDT 2005

Michael G. Schneider wrote:
> From ASP I create response, which is to be shown as an Excel
> worksheet in the user's browser (by setting the ContentType and
> creating a table). This works fine.
>
> Does anybody know what to do, if one of the cells should contain a
> multiline text? I already tried by inserting a <br> inside the <td>.
> But this won't work.

Reverse engineer it. Create a spreadsheet in excel that contains multiline
data, save it as html and look at the source to see what you need to
generate in asp.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



Re: Creating an Excel file from ASP and setting a LineFeed by Michael

Michael
Fri Oct 21 07:44:11 CDT 2005

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> schrieb im Newsbeitrag
news:OxFpGGj1FHA.612@TK2MSFTNGP10.phx.gbl...

> Reverse engineer it. Create a spreadsheet in excel that contains multiline
> data, save it as html and look at the source to see what you need to
> generate in asp.

Thank's a lot for the answer.

Currently, I only set the ContentType corretly, then generate a simple HTML
table with nothing more than some tr's and td's. That is enough for making
Excel show the worksheet.

Reverse engineering the Excel HTML output meant that a lot of "noise" would
have to be generated. There is much more in a HTML file generated by Excel
than the HTML table.

I hoped that there would be some simple mechansim, such as inserted a <br>
or a vbCr or a vbLF or a vbCrLF or something else, which does the trick.

--
Michael G. Schneider
MTLookup http://www.mtlookup.com
Movable Type Weblog http://www.movable-type-weblog.com/



Re: Creating an Excel file from ASP and setting a LineFeed by Bob

Bob
Fri Oct 21 07:57:01 CDT 2005

Michael G. Schneider wrote:
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> schrieb im Newsbeitrag
> news:OxFpGGj1FHA.612@TK2MSFTNGP10.phx.gbl...
>
>> Reverse engineer it. Create a spreadsheet in excel that contains
>> multiline data, save it as html and look at the source to see what
>> you need to generate in asp.
>
> Thank's a lot for the answer.
>
> Currently, I only set the ContentType corretly, then generate a
> simple HTML table with nothing more than some tr's and td's. That is
> enough for making Excel show the worksheet.
>
> Reverse engineering the Excel HTML output meant that a lot of "noise"
> would have to be generated. There is much more in a HTML file
> generated by Excel than the HTML table.

I'm not telling you to use the entire html from the test file ... just find
the part where the line break is accomplished and incorporate that into your
asp code.

I suspect it has something to do with setting the column width (perhaps
using <col> tags). The only way to know for sure is to look at the html that
Excel generates to accomplish the same formatting.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Creating an Excel file from ASP and setting a LineFeed by McKirahan

McKirahan
Fri Oct 21 08:10:18 CDT 2005

"Michael G. Schneider" <mgs-AntiSpam@movable-type-weblog.com> wrote in
message news:O#5tl0j1FHA.2540@TK2MSFTNGP09.phx.gbl...
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> schrieb im Newsbeitrag
> news:OxFpGGj1FHA.612@TK2MSFTNGP10.phx.gbl...
>
> > Reverse engineer it. Create a spreadsheet in excel that contains
multiline
> > data, save it as html and look at the source to see what you need to
> > generate in asp.
>
> Thank's a lot for the answer.
>
> Currently, I only set the ContentType corretly, then generate a simple
HTML
> table with nothing more than some tr's and td's. That is enough for making
> Excel show the worksheet.
>
> Reverse engineering the Excel HTML output meant that a lot of "noise"
would
> have to be generated. There is much more in a HTML file generated by Excel
> than the HTML table.
>
> I hoped that there would be some simple mechansim, such as inserted a <br>
> or a vbCr or a vbLF or a vbCrLF or something else, which does the trick.

[snip]

Bob's suggestion of reverse engineering meant to find the small difference
generated to support multiline data by looking at the HTML output.

My efforts identified this style: { white-space:normal }

What happens when you try this: <td style="white-space:normal">



Re: Creating an Excel file from ASP and setting a LineFeed by Michael

Michael
Fri Oct 21 09:50:23 CDT 2005

"McKirahan" <News@McKirahan.com> schrieb im Newsbeitrag
news:ReqdnchCYsMndcXeRVn-ow@comcast.com...

> Bob's suggestion of reverse engineering meant to find the small difference
> generated to support multiline data by looking at the HTML output.
>
> My efforts identified this style: { white-space:normal }
>
> What happens when you try this: <td style="white-space:normal">

Thank's a lot for the answer. I can confirm that it has something to do with
this style. However, it is not this style alone. For example, if the
following is opened by MS Excel...

<table>
<tr>
<td style="white-space:normal;">1<br>2<br>3<br>4</td>
</tr>
</table>

...four rows will be filled with the numbers.

I think it is best, if I switch over to generating a file that contains all
those Excel specific style information. Then it will work. Finding exactly
which minimum combination of CSS is necessary is probably not worth the
effort.

Thank's again.

--
Michael G. Schneider
MTLookup http://www.mtlookup.com
Movable Type Weblog http://www.movable-type-weblog.com/



Re: Creating an Excel file from ASP and setting a LineFeed by Larry

Larry
Fri Oct 21 14:40:58 CDT 2005


Michael G. Schneider wrote:
> "McKirahan" <News@McKirahan.com> schrieb im Newsbeitrag
> news:ReqdnchCYsMndcXeRVn-ow@comcast.com...
>
> > Bob's suggestion of reverse engineering meant to find the small difference
> > generated to support multiline data by looking at the HTML output.
> >
> > My efforts identified this style: { white-space:normal }
> >
> > What happens when you try this: <td style="white-space:normal">
>
> Thank's a lot for the answer. I can confirm that it has something to do with
> this style. However, it is not this style alone. For example, if the
> following is opened by MS Excel...
>
> <table>
> <tr>
> <td style="white-space:normal;">1<br>2<br>3<br>4</td>
> </tr>
> </table>
>
> ...four rows will be filled with the numbers.
>
> I think it is best, if I switch over to generating a file that contains all
> those Excel specific style information. Then it will work. Finding exactly
> which minimum combination of CSS is necessary is probably not worth the
> effort.

Here's the style I use for wrapping text with possible <BR> breaks.

.text {mso-number-format:General; text-align:general;white-space:
normal;mso-spacerun: yes }


Re: Creating an Excel file from ASP and setting a LineFeed by Michael

Michael
Sat Oct 22 01:12:38 CDT 2005

"Larry Bud" <larrybud2002@yahoo.com> schrieb im Newsbeitrag
news:1129923658.854566.22830@g44g2000cwa.googlegroups.com...

> Here's the style I use for wrapping text with possible <BR> breaks.
>
> .text {mso-number-format:General; text-align:general;white-space:
> normal;mso-spacerun: yes }

Thank's a lot for the answer. This does work.

Does anybody know, whether these style are documented somewhere? Is there a
list, which attributes / values are allowed? Or does anybody know a way for
autosizing the column width?

--
Michael G. Schneider
MTLookup http://www.mtlookup.com
Movable Type Weblog http://www.movable-type-weblog.com/