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
[582 byte] By [
MGS76] at [2007-11-19 19:59:54]

# 1 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
[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.