How can I determine if word wrap is on in a Visual Studio 2003 macro?
Can word wrap be changed with a macro?
Thanks,
Frank
Peter Macej - 11 Jul 2006 09:01 GMT
> How can I determine if word wrap is on in a Visual Studio 2003 macro?
For plain text editor use the following:
Sub toggleWordWrap()
Dim wrap As Boolean
Dim props As EnvDTE.Properties
props = DTE.Properties("TextEditor", "PlainText")
Dim prop As EnvDTE.Property = props.Item("WordWrap")
wrap = prop.Value
prop.Value = Not wrap
End Sub
For other language, change the second parameter of DTE.Properties to
desired language. For the list of language names see keys under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AutomationProperties\TextEditor.

Signature
Peter Macej
Helixoft - http://www.vbdocman.com
VBdocman - Automatic generator of technical documentation for VB, VB
.NET and ASP .NET code
Frank S - 11 Jul 2006 14:37 GMT
>> How can I determine if word wrap is on in a Visual Studio 2003 macro?
>
[quoted text clipped - 12 lines]
> desired language. For the list of language names see keys under
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AutomationProperties\TextEditor.
Peter,
Thanks for the help. That is exactly what I needed. (I had done some
searching, but did not find anything about this property.)
Frank
Carlos J. Quintero [VB MVP] - 11 Jul 2006 09:17 GMT
See the macros TurnOnWordWrap / TurnOffWordWrap supplied in the Samples
macro project, Utilities module.
Also, there is a command that you can execute to toggle the word wrap:
DTE.ExecuteCommand("Edit.ToggleWordWrap")

Signature
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
> How can I determine if word wrap is on in a Visual Studio 2003 macro? Can
> word wrap be changed with a macro?
>
> Thanks,
>
> Frank
"Gary Chang[MSFT]" - 11 Jul 2006 09:24 GMT
Hi Frank,
Thank you posting!
Besides Peter's solution, you can also use issue the following command in
your macro to toggle the wordwrap status directly:
DTE.ExecuteCommand("Edit.ToggleWordWrap")
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.