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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One text string into the multiple HTML columns?

Status
Not open for further replies.

pomopomo

Technical User
Jan 1, 2003
1
FI
Hi,

I need to format content of text string into the multiple "newspaper-like" HTML columns in page made in asp.

I'd like to have a dynamic number of columns, depends of the amount of text. I understand, that it could be a repeat region, but there must be also some chunk of code to get the text to be divided into the columns....

I tried to search over the web about it, but didn't found any relevant tutorial or code sample, the closest thing is the following code:
it's splits the text into the two columns, but I need more.

If somebody knows the solution, or can point to the right place, I will really appreciate it.

Thanks,
pomopomo.
 
I didn't check to make sure that you aren't splitting a word in two in the columns, but you get the idea. Let me know if I should elaborate...

<%
cssStr = &quot;&quot;
select case true
case myString < 1000
numCols = 1
cssStr = &quot;.id1 {position: absolute; top: 0; left:0; width:700;}&quot;
case myString < 2000
numCols = 2
cssStr = &quot;.id1 {position: absolute; top: 0; left:0; width:375;}&quot;&_
vbcrlf&_
cssStr = &quot;.id2 {position: absolute; top: 0; left:400; width:375;}&quot;
case else
numCols = 3
cssStr = &quot;.id1 {position: absolute; top: 0; left:0; width:250;}&_
vbcrlf&_
cssStr = &quot;.id2 {position: absolute; top: 0; left:275; width:250;}&quot;&_
vbcrlf&_
cssStr = &quot;.id3 {position: absolute; top: 0; left:550; width:250;}&quot;
end select


htmlStr = &quot;&quot;
for i = 1 to numCols
htmlStr = htmlStr &_
&quot;<span id=col&quot; & i & &quot;>&quot; & mid(myString,1 + (1000 * (numCols - 1)),1000) & &quot;</span>&quot;
next
%>

<style>
<%=cssStr%>
</style>

<%=htmlStr%>

Get the Best Answers! faq333-2924
Happy 2003! [cheers]
mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top