Question

I am currently in the process of creating API documentation using Microsoft Word 2007 and I need the user to cut and paste a section from the document into their web.config.

I formatted the section in the Microsoft Word document for easy readability and when I paste the formatted section into the web.config it maintains the style from the Microsoft Word document.

Is there a way for the user to auto format the section to their preferred web.config layout?

Edit

The documentation is formatted like so in Microsoft Word:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicEndPoint">
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>

When the user adds the section from the word document to their web.config, I want it to match their preferred formatting style. No line breaks, different indentation, etc.

Edit 1:

I removed all the page breaks from the configuration section and used Ctrl+K, Ctrl+D to format the entire document. I updated the code sample to reflect what is looks like in the Word document.

Was it helpful?

Solution

You could always recommend that your user just hits Ctrl+K, Ctrl+D which will reformat their web.config after pasting. (From the menu, Edit/Advanced/Format Document)

Visual Studio does a pretty good job at keeping XML files formatted nicely.

OTHER TIPS

You may want to be careful with this - Word isn't designed to handle code, and the problems don't stop with whitespace formatting. Have you ever tried to debug an issue caused by a parameter containing a dash instead of a hyphen?

The formatting itself depends on the tool used to edit web.config. Assuming visual studio, pasted code is expected to be ugly, but is easily fixed with ctrl-k-d

I don't really understand your question, but copying and pasting from Microsoft Word 2007, Notepad and Visual Studio, you can copy from any of them to the other and you can still maintain the formatting (Notepad will lose the coloring though).

A suggestion, why don't you provide them with a web.config file that is beefed up with all the necessary configurations possible, comment them and describe them in your documentation. In other words, section X defines doing so-and-so by uncommenting the lines 10-12 and editing the value of K to the number or path they need to, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top