getting height of a block of text

K

Keith G Hicks

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
 
M

Michael Nemtsev [MVP]

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>
 
K

Keith G Hicks

Michael Nemtsev said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top