Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > getting height of a block of text

Reply
Thread Tools

getting height of a block of text

 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-12-2008
I am converting an MS Access app that I wrote sevearl years ago for a client
over to ASP. There's a feature in the app that I am not sure how to do in
ASP and need some input on.

They need to know the height in inches of a block of text formatted a
certain way for determining layout in a newspaper. The block of text will
vary in content and lenght from record to record so here's what I did in
Access: I open up an invisible instance of MS Word on the client machine,
set the margins, font, etc., paste the text in and using some unusal word
doc properties I can figure out the height in inches. It's worked well for
quite some time.

I know from some of my recent research that it's a bad idea to try to
automate Word on the server for many clients. Everyone says it's a big mess
to deal with and Microsoft advises against it. So I'm tryign to figure out
the best way to handle this. It occurred to me taht I could put a hidden
table (1 row by 1 column) on a page, set the width, font, etc, in design and
then in code, paste the text in. I noticed that the cell stretches in height
to fit the text. Seems like I could get the hieght after all that occurs.
I'm worndering if this is a good solution or not and if not, what other
solutions might be sensible.

Any help would be greatly appreciated.

Thanks,

Keith


 
Reply With Quote
 
 
 
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      02-12-2008
Hello Keith,

What happens if the user change the font size in browser?

I think that using the Silverlight in your case will be the best solution,
because there you have all necessary instuments to meausure you fonts and
create the right layout height

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


KH> I am converting an MS Access app that I wrote sevearl years ago for
KH> a client over to ASP. There's a feature in the app that I am not
KH> sure how to do in ASP and need some input on.
KH>
KH> They need to know the height in inches of a block of text formatted
KH> a certain way for determining layout in a newspaper. The block of
KH> text will vary in content and lenght from record to record so here's
KH> what I did in Access: I open up an invisible instance of MS Word on
KH> the client machine, set the margins, font, etc., paste the text in
KH> and using some unusal word doc properties I can figure out the
KH> height in inches. It's worked well for quite some time.
KH>
KH> I know from some of my recent research that it's a bad idea to try
KH> to automate Word on the server for many clients. Everyone says it's
KH> a big mess to deal with and Microsoft advises against it. So I'm
KH> tryign to figure out the best way to handle this. It occurred to me
KH> taht I could put a hidden table (1 row by 1 column) on a page, set
KH> the width, font, etc, in design and then in code, paste the text in.
KH> I noticed that the cell stretches in height to fit the text. Seems
KH> like I could get the hieght after all that occurs. I'm worndering if
KH> this is a good solution or not and if not, what other solutions
KH> might be sensible.
KH>
KH> Any help would be greatly appreciated.
KH>
KH> Thanks,
KH>
KH> Keith
KH>


 
Reply With Quote
 
 
 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-12-2008


"Michael Nemtsev [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) .com...
> Hello Keith,
>
> What happens if the user change the font size in browser?


We considered that but figured there would be a way around it. All of this
is very new to me so I'm kind of fishing around for what to do here. Not
sure at all what the options are.

> I think that using the Silverlight in your case will be the best solution,
> because there you have all necessary instuments to meausure you fonts and
> create the right layout height


I've never heard of Silverlight. I looked it up and found some references
but they all seem very vague as is usually the case with something new. I
found nothing that clearly explains what it is. This quote is from the MS
site:

MicrosoftR SilverlightT is a cross-browser, cross-platform plug-in for
delivering the next generation of media experiences and rich interactive
applications for the Web.

That sentence means nothing whatsoever. It's just PR fluff.

So what is Silverlight? Is it a new browser from MS? Is it a box of tools?
???

I am very new to all of this (asp, web development, etc) so I'm hoping
someone out there can point me to some good clear detailed information on
what to do.


> ---
> WBR,
> Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
>
> "The greatest danger for most of us is not that our aim is too high and we
> miss it, but that it is too low and we reach it" (c) Michelangelo
>
>
> KH> I am converting an MS Access app that I wrote sevearl years ago for
> KH> a client over to ASP. There's a feature in the app that I am not
> KH> sure how to do in ASP and need some input on.
> KH>
> KH> They need to know the height in inches of a block of text formatted
> KH> a certain way for determining layout in a newspaper. The block of
> KH> text will vary in content and lenght from record to record so here's
> KH> what I did in Access: I open up an invisible instance of MS Word on
> KH> the client machine, set the margins, font, etc., paste the text in
> KH> and using some unusal word doc properties I can figure out the
> KH> height in inches. It's worked well for quite some time.
> KH>
> KH> I know from some of my recent research that it's a bad idea to try
> KH> to automate Word on the server for many clients. Everyone says it's
> KH> a big mess to deal with and Microsoft advises against it. So I'm
> KH> tryign to figure out the best way to handle this. It occurred to me
> KH> taht I could put a hidden table (1 row by 1 column) on a page, set
> KH> the width, font, etc, in design and then in code, paste the text in.
> KH> I noticed that the cell stretches in height to fit the text. Seems
> KH> like I could get the hieght after all that occurs. I'm worndering if
> KH> this is a good solution or not and if not, what other solutions
> KH> might be sensible.
> KH>
> KH> Any help would be greatly appreciated.
> KH>
> KH> Thanks,
> KH>
> KH> Keith
> KH>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting exact height of a panel with a height="100%" samer ASP .Net 3 09-28-2009 05:21 PM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
how to get specific cell height without hard-coding a height value laredotornado@zipmail.com HTML 0 08-19-2006 08:13 PM
Measuring the height of a block of text Gingko Javascript 0 02-01-2004 02:04 AM



Advertisments