• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

How do I change the tab settings in powerpoint from within a VB .net program

I am creating a powerpoint presentation from within VB .NET.  Does anyone know how I can change the value of the tab settings programatically?  I am using  a text box to enter data that I want to be formatted into columns.  Counting the string length doesn't work, because all different characters have different sizes.  I think I remember from a long time ago that you could change that, but I don't remember the term for that.  That would solve my problem as well, ( if every string that had 20 characters had exactly the same length in inches when displayed)  Any help on this would be greatly appreciated.  Thanks
0
spmcmorrow
Asked:
spmcmorrow
1 Solution
 
RonaldBiemansCommented:
You can measure the exact lenght (in this case in millimeters, but you can change that to inches, pixels etc) of your string depended on the used font like this

    Public Function MeasureStringMin(ByVal StrText As String, ByVal StrFont As Font) As SizeF
        Dim stringSize As New SizeF
        Dim e As Graphics
        e = Me.CreateGraphics
        e.PageUnit = GraphicsUnit.Millimeter
        stringSize = e.MeasureString(StrText, StrFont)
        Return stringSize
    End Function

call like this

        Dim stringFont As New Font("Arial", 8)
        MsgBox(MeasureStringMin("yourtext", stringFont).Width)



0
 
spmcmorrowAuthor Commented:
Thank you.  That is great to know and would solve my problem.  I also realized that the type of font I was looking for and couldn't remember yesterday was a monospaced font like courier new.  I ending up using that font and lining up my columns using the string length.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now