pixels, twips and things-VBForums
Results 1 to 4 of 4

Thread: pixels, twips and things

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    5

    pixels, twips and things

    Im trying to dump the contents of an MSFlexGrid into an excel sheet and set the widths of the excel columns to be the same as the flex grid. I have a couple problems.

    1. I can't find the units of measurement used by a flex grid.

    2. Excel uses a unit of measurement that is the number of average sized characters that can fit in a cell. Well how do i convert from pixels, or whatever the flex grid is using, to this weird system?

    Thanks

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,817

    Re: pixels, twips and things

    Quote Originally Posted by jsteel
    Im trying to dump the contents of an MSFlexGrid into an excel sheet and set the widths of the excel columns to be the same as the flex grid. I have a couple problems.

    1. I can't find the units of measurement used by a flex grid.

    2. Excel uses a unit of measurement that is the number of average sized characters that can fit in a cell. Well how do i convert from pixels, or whatever the flex grid is using, to this weird system?

    Thanks
    The flex grid uses TWIPS (1/20 of a printer point).

    72 points per inch
    20 twips to a point
    1440 twips per inch

    The FLEXGRID has a .TEXTWIDTH property that will give you the TWIP size of any string you pass it.

    I'm not sure how EXCEL does the average - you could pass each character - A to Z to .TEXTWIDTH and strike an average in VB - not sure if that is a match though.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    15,817

    Re: pixels, twips and things

    BTW - Welcome to the forum!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,187

    Re: pixels, twips and things

    szlamany beat me to the different scales, but here's the what you need for Excel (from Excel's help for ColumnWidth):

    "Use the Width property to return the width of a column in points."

    As 1 point = 20 twips, you just need to divide the Grid sizes by 20.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.