none
How to measure string in xslt? RRS feed

Answers

  • I want to place a dynamic string on letter. but my problem is when i place string. it will overlap paper.
    Thank everyone to reply. many thank and many thank.
    • Marked as answer by 司马格伦 Thursday, July 2, 2009 5:14 AM
    Tuesday, June 30, 2009 4:18 AM

All replies

  • You can use xpath fucntion string-length(string) to get the length of a string. But how to know the pixel for every character is out of the scope of MSXML I think.
    Monday, June 29, 2009 9:47 AM
  • I am curious why you need the "display size" of a string. Can you explain your scenario a little bit?
    Shuhai Shen - http://leonax.net
    Monday, June 29, 2009 11:12 AM
  • If You can measure it at the server, GDI+ is also a choice. Use System.Drawing.Graphics.MeasureString() function to get the pixels. For more information about the function, you could visit http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx

    Monday, June 29, 2009 11:41 AM
  • I want to place a dynamic string on letter. but my problem is when i place string. it will overlap paper.
    Thank everyone to reply. many thank and many thank.
    • Marked as answer by 司马格伦 Thursday, July 2, 2009 5:14 AM
    Tuesday, June 30, 2009 4:18 AM
  • If you want to display a paragraph on a web page, there're plenty of ways to avoid the overlap. And I'd recommend CSS. Use this and it would never overlaps:

            .FixedDiv
            {
                width: 270px;
                white-space: nowrap;
                text-overflow: ellipsis;
                -o-text-overflow: ellipsis;
                overflow: hidden;
            }

    and use it in a div:

    <div class="FixedDiv">dasl;fjlasdfdjsaflkasdfjkdasfaldsjaflksdajflkdasfjldkasdafdasfdasfdasfdasfdasfdasfsfjadsf</div>
    • Proposed as answer by Hooray Hu Thursday, July 2, 2009 7:32 AM
    Thursday, July 2, 2009 7:32 AM