473,804 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4240
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****@postrep lyhere.com> wrote in message
news:Bf******** ************@co mcast.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******** *****@TK2MSFTNG P10.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,sma rt" 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****@postrep lyhere.com> wrote in message
news:x9******** ************@co mcast.com...
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:On******** *****@TK2MSFTNG P10.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,sma rt" 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****@postrep lyhere.com> wrote in message
news:Bf******** ************@co mcast.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.ne t> wrote in message
news:OH******** ******@tk2msftn gp13.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****@postrep lyhere.com> wrote in message
news:Bf******** ************@co mcast.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
1500
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 / Formatting. This is a big annoyance because with a rather large page it can be very time consuming to reformat by hand, and very time consuming to search through and work with the mangled formatting that often happens do switching to the design...
1
1432
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 going on when we come back to the document later.</sarcasm> In any case, the editor, when switching from HTML view to the designer view will do crazy things like completely remove all of the formatting in the HTML as well as remove style and other...
3
2475
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 features of this excellent source editor but recently it has only operated on some of my source files and not others. I have made sure the settings in "tools->options->text editor" are set correctly but to no avail. For example, hitting enter at the...
7
2515
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 intellisense like VB does?
2
1557
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 Editor-->HTML/XML-->Format But the VS still does the HTML code auto-formatting. The most notable is the auto-conversion of "&raquo;" to ">>" and the likes which make some pages look ugly on other browsers.
5
2969
by: Divvy Ballacks | last post by:
Hello, does anyone know of such a freebie. If so a link would be much appreciated.
1
1797
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
1006
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
38018
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 little terminal and Safari magic, you will be sending HTML signatures. 1. Prepare your HTML signature. Open TextEdit or your favorite HTML editor and create your signature just how you want it to look. Remember to keep it simple as most mail...
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.