Ian Vink

Word 2003, C#

In VBA to set the HeadingFormat I would use:
.Selection.Rows.HeadingFormat = true

But in C#, the HeadingFormat expects an Int. I've tried
wordapp.Selection.Rows.HeadingFormat = 1;

But it fails.




Re: Visual Studio Tools for Office C# .Selection.Rows.HeadingFormat = true

Cindy Meister

Try negative 1 (-1)






Re: Visual Studio Tools for Office C# .Selection.Rows.HeadingFormat = true

Ian Vink

I tried that but it doesn't accept it. I get an error.




Re: Visual Studio Tools for Office C# .Selection.Rows.HeadingFormat = true

Cindy Meister

And what is the error MESSAGE






Re: Visual Studio Tools for Office C# .Selection.Rows.HeadingFormat = true

Cindy Meister

Ian Vink wrote:
Word 2003, C#

In VBA to set the HeadingFormat I would use:
.Selection.Rows.HeadingFormat = true

But in C#, the HeadingFormat expects an Int. I've tried
wordapp.Selection.Rows.HeadingFormat = 1;

But it fails.


I just double-checked this. I doubt you used the code you show in VBA, either. Because you have to specify the RowIndex of the last row that should be repeated. If you set it for all the rows in the table, which is what your code would do, that wouldn't make sense. So your code isn't accepted.

It would help us help you a lot if you would give the error information. Especially since you're obviously not working with VSTO and are technically off-topic in the forum. Keep in mind that the people who help out here do this in their free time, and no one likes to waste their free time.

tbl.Rows[1].HeadingFormat = -1;