CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2001
    Location
    Wuerzburg, Germany
    Posts
    90

    OLE Word automation - Problem with table

    Hello,

    I want to change the width of a table with ole. What I wanna do is the action from this vba-makro:
    Selection.Columns.PreferredWidthType = wdPreferredWidthPercent
    Selection.Columns.PreferredWidth = 60

    What I have is this:
    Table table = ((Tables)m_Doc.GetTables()).Add(range, 1, 2);
    Columns cols = table.GetColumns();
    Column col = cols.GetFirst()
    col.SetProperty(???, 2);
    col.SetWidth(60, 0);

    What is missing is the value of ???.
    Where can I find documentation of DISPID?

    Thanks

    Michael

  2. #2
    Join Date
    Apr 2002
    Location
    Michigan, USA
    Posts
    869

    Re: OLE Word automation - Problem with table

    When I look at the column class of the type library with OleView
    (VS 6.0) or the Object inspector in VS.Net I find

    Code:
    [id(0x0000006a), propput, helpcontext(0x094b006a)]
    void PreferredWidthType([in] WdPreferredWidthType rhs);
    So I would guess the property number is 6a in hex or 106 in decimal.


    ***************************
    What version of Word are you using? What version of VC++?

    When I do this I would use

    col.SetPreferredWidthType(2);
    col.SetWidth(60,0);

    because SetProperty isn't even a member of my Column class.
    Last edited by Tom Frohman; March 23rd, 2006 at 02:49 PM.
    Verere testudinem! (Fear the turtle)

    Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy. -Albert Einstein

    Robots are trying to steal my luggage.

  3. #3
    Join Date
    Jun 2001
    Location
    Wuerzburg, Germany
    Posts
    90

    Re: OLE Word automation - Problem with table

    Hi,

    I user VC 6.0 and Word XP. And I can't finde the SetPreferredWidthType function.

    Michael

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured