Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TD, rowspan and compression 1

Status
Not open for further replies.

Chopstik

Technical User
Oct 24, 2001
2,180
US
I am trying to modify a reporting format in order to add a new row that will be used to add a report description. In some cases, the data that will be shown on the screen will exceed the horizontal length of the report so I figured that I would rowspan=2 to account for instances where it may go to the next line. I've gotten it to work so that it will show the new row correctly but have discovered that it now compresses the report (but the horizontal bar on the bottom still goes across what is now whitespace). If I remove the rowspan, then it doesn't show any of the additional lines. I am at something of a loss to understand why this should be and am wondering if someone else has encountered this problem or can recommend a potential solution. Any advice would be greatly appreciated. Below is a sample of the rendered HTML for that one TD, but I can give the full code if need be (I hesitate only because it is a long piece of code using XML and HTML).

Code:
<TR height=21 style='height:15.75pt'>
<TD width=1100 height=21 [COLOR=red]rowspan=2[/color] colspan=19 class=normal style='height:15.75pt;mso-ignore:colspan'><strong>Report Desc: </strong>This report lists a bunch of information that people might actually use.  But what I am really wondering is how long this will need to go on in order to get something useful.  I suppose I could drag this out for quite a while in order to get it to go over two lines but then I'm wondering whether or not this will bring back the proper values.  I'm also wondering what will happen should it encounter any apostrophes.  It may fail or it may work...  It's up in the air at the moment...  I can't wait to see what happens...  And if I push this down just a little further, does it cause additional problems with the word wrap functionality that is not working as it is...</TD></TR>

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
This cell spans 19 columns. Whatever it is, there needs to be at least 19 columns defined somewhere. If you give your row a span of two, that means that the new row (<tr>) must take into account that one field already spreads 19 columns. If it does not, then you will see white-space and your table will break.

What exactly do you need the rowspan for? If I read your description, I would think just regular behaviour of tables, expanding the cells when there is more content, would be enough. Can you give a link to the example?
 
The number of columns is dynamic but the cell (and the others at the top which are just like header fields) all expand to whatever the number of columns may be. In this particular instance, there are 19 columns which are detailed in the code below (that I didn't want to list but can if necessary). All I can provide is the rendered HTML (it is derived from ASP and a VB function) but I don't have any links to it because it is an intranet application not available on the 'net.

I need the rowspan because I may have instances where the length of the field may not be wide enough (in this case, 19 columns was not enough space) to hold it all on one line. If I don't include the rowspan, then it just cuts off. If I *do* include the rowspan, then it will show everything on multiple lines (when needed), but it compresses the width of the nineteen columns in the report. They all show, but you can't see all of the data. It doesn't really make sense to me...

Would it help to post all of the code?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Probably not. But I will continue saying this. If you have too much content for a table cell, by default the table cell will expand vertically to fit the contents. That will not happen if:

- you're applying CSS to combat that behaviour;
- you have absolutely no spaces in the output string.

Using rowspan to accomodate long strings in a small cell is incorrect usage of this attribute and I would avoid it.
 
It's possible that CSS is being applied to combat the behaviour since it is not expanding vertically to fit the contents (which is what usually happens elsewhere in my application). I guess part of what is throwing me here is that it does not expand like it does elsewhere in my app (but since I didn't build this part originally, I'm having to track what the original developer did and it's really *unusual* - for lack of a better term. I've looked at the CSS file but don't see anything that would address that, so maybe that's not the problem... Is there something in CSS that would address that issue specifically that I should be looking for?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Ah, something just tripped in my head... The report allows for the ability to convert it to an Excel spreadsheet. After going back to review the top part of the rendered HTML, I thought about the CSS formatting as you suggested and see that it does turn off wrapping for white-space (I've marked in red below) and I'm wondering if this may be causing my problem. I think so, but now I'm wondering how to fix... I'll start working on this and see if there's a good solution. Any thoughts?
Code:
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="[URL unfurl="true"]http://www.w3.org/TR/REC-html40">[/URL]
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Link Properties 4</o:Author>
  <o:Company>SunTrust Banks</o:Company>
  <o:Version>9.3821</o:Version>
 </o:DocumentProperties>
 <o:OfficeDocumentSettings>
  <o:DownloadComponents/>
  <o:LocationOfComponents HRef="file:msowc.cab"/>
 </o:OfficeDocumentSettings>
</xml><![endif]-->
<style>
<!--TABLE
{
    mso-displayed-decimal-separator: ".";
    mso-displayed-thousand-separator: ","
}
@page
{
	margin:.25in .25in .25in .25in;
	mso-header-margin:.25in;
	mso-footer-margin:.25in;
	mso-page-orientation:landscape;
}
TR
{
    mso-height-source: auto
}
COL
{
    mso-width-source: auto
}
BR
{
    mso-data-placement: same-cell
}
TD
{
    BORDER-RIGHT: medium none;
    PADDING-RIGHT: 1px;
    BORDER-TOP: medium none;
    PADDING-LEFT: 1px;
    FONT-WEIGHT: 400;
    FONT-SIZE: 10pt;
    VERTICAL-ALIGN: bottom;
    BORDER-LEFT: medium none;
    COLOR: windowtext;
    PADDING-TOP: 1px;
    BORDER-BOTTOM: medium none;
    FONT-STYLE: normal;
    FONT-FAMILY: Arial;
    [COLOR=red]WHITE-SPACE: nowrap;[/color]
    TEXT-DECORATION: none;
    mso-number-format: General;
    mso-rotate: 0;
    mso-background-source: auto;
    mso-pattern: auto;
    mso-generic-font-family: auto;
    mso-font-charset: 0;
    mso-protection: locked visible;
    mso-style-parent: normal;
    mso-ignore: padding
}
.normal
{
    FONT-WEIGHT: 400;
    FONT-SIZE: 10pt;
    VERTICAL-ALIGN: bottom;
    COLOR: windowtext;
    FONT-STYLE: normal;
    FONT-FAMILY: Arial;
    [COLOR=red]WHITE-SPACE: nowrap;[/color]
    TEXT-DECORATION: none;
    mso-number-format: General;
    mso-style-name: Normal;
    mso-style-id: 0;
    mso-rotate: 0;
    mso-background-source: auto;
    mso-pattern: auto;
    mso-generic-font-family: auto;
    mso-font-charset: 0;
    mso-protection: locked visible
}

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
To paraphrase Spock, when you remove the impossible then whatever is left, no matter how improbable, is your answer. In this case, your comment about the default actions of wrapping in a TD when the value exceeds the width made me think of another way to look at the problem. My post just above does not appear to have been the problem, but it made me look at how the page was being derived and it would appear that the problem may have been in the <THEAD> section. The style width was 75% of the TD width.
Code:
<TD width=60 height=5 style='height:4pt;width:45pt' class=header></TD>
I made them the same length and the problem appeared to resolve itself. I will note that I did still have to use the rowspan (which I don't understand, particularly since it is not the preferred method and there was nothing I could find in CSS that would have changed it), but it now works as expected. Thanks for your help!

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I think you're actually paraphrasing Sherlock Holmes (or Sir Arthur Conan Doyle). [smile]
 
Sherlock Holmes, Spock, it's all relative... [lol]

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top