473,378 Members | 1,209 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,378 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 4111
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.