getting height of a block of text

Discussion in 'ASP .Net' started by Keith G Hicks, Feb 12, 2008.

  1. 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
     
    Keith G Hicks, Feb 12, 2008
    #1
    1. Advertising

  2. 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>
     
    Michael Nemtsev [MVP], Feb 12, 2008
    #2
    1. Advertising

  3. "Michael Nemtsev [MVP]" <> wrote in message
    news:...
    > 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>
    >
    >
     
    Keith G Hicks, Feb 12, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    586
  2. Wotney
    Replies:
    1
    Views:
    551
    Flinky Wisty Pomm
    Oct 25, 2006
  3. morrell
    Replies:
    1
    Views:
    1,006
    roy axenov
    Oct 10, 2006
  4. samer
    Replies:
    3
    Views:
    464
    Gregory A. Beamer
    Sep 28, 2009
  5. Gingko
    Replies:
    0
    Views:
    106
    Gingko
    Feb 1, 2004
Loading...

Share This Page