PDA

View Full Version : Urgentl Help Needed - setting preferred width of table



monikamalik
09-15-2007, 09:39 PM
HI all
can someone help me to read the table 's preferred width.

Please help me.

TonyJollans
09-16-2007, 03:21 AM
Ummm...

Table_ref.PreferredWidth

Of course it is only preferred and is not necessarily the actual width.

monikamalik
09-16-2007, 06:12 AM
I have tried

nestedTable.PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPercent;
MessageBox.Show(nestedTable.Columns.PreferredWidth.ToString());
int tableW = Convert.ToInt32(nestedTable.PreferredWidth);
MessageBox.Show(tableW.ToString ());

But its not working either way.

Please help.
Ihave to complete this task or my PM will kill me.... :banghead:

TonyJollans
09-16-2007, 06:32 AM
I'm sorry but I have no idea what you are trying to do, and you're clearly not working in VBA although that shouldn't matter.

What exactly is the task your PM wants you to do? And what happens when you run your code - 'not working' doesn't tell me much.

TonyJollans
09-16-2007, 06:34 AM
I also see that you are looking at the Table's preferred width and the Column's preferred width. Which is it that you want?

monikamalik
09-16-2007, 06:56 AM
I am using c#.net for automation of word .... And i am trying to get any element's width(table or column).But i need tables's preferred width.but everytime it result in 999999.


my PM want that watever preferred width setin word document same will be resulted in our htm files.

TonyJollans
09-16-2007, 08:19 AM
9999999 means that there are multiple different values over the range you have queried.

There are many factors that influence table and column widths and the preferred width is but one of them, and it is not set by default so it probably isn't what you want to be looking at.

Try looking at the Width instead.