473,221 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

Auto html format/indent in Visual Studio .NET?

Is there any way to tell VS to automatically reformat my HTML view to add
lines and tabs/spacing to create nicely formatted HTML in the viewer? I am
using Visual Studio 2005 .NET Beta 2

For example, let's say I paste this HTML into VS.NET "source" view:

<table><tr><td>val1</td><td>val2</td></tr></table>

I'd like to issue a command to VS to have it reformat this source and change
it to this in the editor:

<table>
<tr>
<td>val1</td>
<td>val2</td>
</tr>
</table>

Is there any such command or built-in functionality to do this?

If not, does anyone know of a 3rd party tool (or perhaps an alternative HTML
designer tool) that will do this?

Thanks!

Steve
Nov 19 '05 #1
5 4104
Try this :

"Tools", "Options", select the checkbox "Show All Settings",
scroll to "Text Editor", and then "All languages", "Tabs",
and set your default "Indenting" and "Tab" preferences.

It will work the way you set it from that point on.

It should reformat the HMTL source to the specs you select
when you close and open the file after pasting the code,
although I don't guarantee it.

I don't know if it will reformat poorly-formatted
code to the extent you say you want it reformatted.

It's worth a try, anyway.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Steve Franks" <pl****@postreplyhere.com> wrote in message
news:Bf********************@comcast.com...
Is there any way to tell VS to automatically reformat my HTML view to add lines and
tabs/spacing to create nicely formatted HTML in the viewer? I am using Visual Studio
2005 .NET Beta 2

For example, let's say I paste this HTML into VS.NET "source" view:

<table><tr><td>val1</td><td>val2</td></tr></table>

I'd like to issue a command to VS to have it reformat this source and change it to this
in the editor:

<table>
<tr>
<td>val1</td>
<td>val2</td>
</tr>
</table>

Is there any such command or built-in functionality to do this?

If not, does anyone know of a 3rd party tool (or perhaps an alternative HTML designer
tool) that will do this?

Thanks!

Steve

Nov 19 '05 #2

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:On*************@TK2MSFTNGP10.phx.gbl...
Try this :

"Tools", "Options", select the checkbox "Show All Settings",
scroll to "Text Editor", and then "All languages", "Tabs",
and set your default "Indenting" and "Tab" preferences.

It will work the way you set it from that point on.

It should reformat the HMTL source to the specs you select
when you close and open the file after pasting the code,
although I don't guarantee it.


Thanks.I fFound that but its not making any difference. Here's what I am
doing:

I do not have a Show All Settings checkbox. However I did fine Text
Editor-All Languages-Tabs. In the top section none of the radio boxes for
"none,block,smart" were checked. I tried selecting "block", then I created
a new page and cut/pasted html but it did not reformat it. I tried saving it
and it didn't make a difference. Then I switched to Design view and back to
Source mode, still no difference. Then I repeated the same thing but with
"smart" radio selected. Nonthing made a difference.

Any ideas?

Thanks,

Steve
Nov 19 '05 #3
re:
Any ideas?
Nailed it...

"Tools", "Options", scroll to "Text Editor", and then "HTML",
"Miscellaneous", select "Format HTML on Paste".

That does exactly what you want.

It's amazing what you can find out by playing around with the IDE.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Steve Franks" <pl****@postreplyhere.com> wrote in message
news:x9********************@comcast.com...
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:On*************@TK2MSFTNGP10.phx.gbl...
Try this :

"Tools", "Options", select the checkbox "Show All Settings",
scroll to "Text Editor", and then "All languages", "Tabs",
and set your default "Indenting" and "Tab" preferences.

It will work the way you set it from that point on.

It should reformat the HMTL source to the specs you select
when you close and open the file after pasting the code,
although I don't guarantee it.


Thanks.I fFound that but its not making any difference. Here's what I am doing:

I do not have a Show All Settings checkbox. However I did fine Text Editor-All
Languages-Tabs. In the top section none of the radio boxes for "none,block,smart" were
checked. I tried selecting "block", then I created a new page and cut/pasted html but
it did not reformat it. I tried saving it and it didn't make a difference. Then I
switched to Design view and back to Source mode, still no difference. Then I repeated
the same thing but with "smart" radio selected. Nonthing made a difference.

Any ideas?

Thanks,

Steve

Nov 19 '05 #4
Simply press:
Control + K
Control + D

....and the code will be auto-formatted. This works in HTML and in code
(VB/C#) windows.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Steve Franks" <pl****@postreplyhere.com> wrote in message
news:Bf********************@comcast.com...
Is there any way to tell VS to automatically reformat my HTML view to add
lines and tabs/spacing to create nicely formatted HTML in the viewer? I
am using Visual Studio 2005 .NET Beta 2

For example, let's say I paste this HTML into VS.NET "source" view:

<table><tr><td>val1</td><td>val2</td></tr></table>

I'd like to issue a command to VS to have it reformat this source and
change it to this in the editor:

<table>
<tr>
<td>val1</td>
<td>val2</td>
</tr>
</table>

Is there any such command or built-in functionality to do this?

If not, does anyone know of a 3rd party tool (or perhaps an alternative
HTML designer tool) that will do this?

Thanks!

Steve

Nov 19 '05 #5
Yup.

That does exactly the same thing, but setting the
"Format HTML on Paste" option doesn't even
require doing that, when pasting.

That's a nifty keyboard shortcut when you're a sloppy coder, though.
Two commands, and everything is formatted for you.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:OH**************@tk2msftngp13.phx.gbl...
Simply press:
Control + K
Control + D

...and the code will be auto-formatted. This works in HTML and in code (VB/C#) windows.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Steve Franks" <pl****@postreplyhere.com> wrote in message
news:Bf********************@comcast.com...
Is there any way to tell VS to automatically reformat my HTML view to add lines and
tabs/spacing to create nicely formatted HTML in the viewer? I am using Visual Studio
2005 .NET Beta 2

For example, let's say I paste this HTML into VS.NET "source" view:

<table><tr><td>val1</td><td>val2</td></tr></table>

I'd like to issue a command to VS to have it reformat this source and change it to this
in the editor:

<table>
<tr>
<td>val1</td>
<td>val2</td>
</tr>
</table>

Is there any such command or built-in functionality to do this?

If not, does anyone know of a 3rd party tool (or perhaps an alternative HTML designer
tool) that will do this?

Thanks!

Steve

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Seth | last post by:
How can I completely turn off the auto formatting of Html in Visual Studio 7? I have tried all possible combinations (at least I think I have) of the Tools / Options / Text Editor / HTML XML /...
1
by: Craig Hunt | last post by:
Am I missing something here? Quite frequently, I'll write an aspx document taking care to format the HTML so that I and others on my team can read it. <sarcasm>We kind of like to know what's...
3
by: Robin Tucker | last post by:
Hi there, I have this really frustrating problem with Visual Studio (Microsoft Visual Basic .NET 2003 69586-335-0000007-18843). I have got used to using the autocomplete and auto indent...
7
by: Aaron | last post by:
I like some of the auto-formatting features of VB.NET (god help me) but I really prefer to use CSharp (C#) is there any way to get the features of auto-indenting, auto-capitalization, and advanced...
2
by: hb | last post by:
Hi, The auto-formatting of HTML code in Visual Studio.Net 2003 is very annoying! I already unchecked the 2 checkboxes in "Apply Automatic Formatting" section located at: Tools-->Options-->Text...
5
by: Divvy Ballacks | last post by:
Hello, does anyone know of such a freebie. If so a link would be much appreciated.
1
by: stonny | last post by:
Hi, I am editing code under visual studio 2003 environment. Does it have a 'Smart Indent' function like matlab does? Thanks
0
by: Jack | last post by:
How to enable the auto indent function in visual studio? For example: void f() { for(int i = 0; i < 10; i++) { cout << a; //When I type this line, indent automatically. }
0
digicrowd
by: digicrowd | last post by:
http://bytes.com/images/howtos/applemail_sig_icon.jpg At first glance, it may not appear that Apple Mail (otherwise known as Mail.app) supports the use of HTML signature emails. However, with a...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.