We have a number of plain text, MS word, and pdf documents that we want to be formatted in fixed width / fixed cols format in a plain text file, similar to many readmes found out in the wild. I have struggled to find anything via various google searches. I can write some code to do it, but why reinvent the wheel if someone already has a util. Thanks for any suggestions.
2 Answers
Using Notepad++'s Split Lines functionality can do this for TEXT files.
- Open your text file - your lines of text will either appear to go off the screen (if you have word wrapping off) or word wrapping will wrap your lines.
- Resize your Notepad++ window to how wide you want the new "width" to be
Ctrl + A
to select your entire document- Click
Edit
->Line Operations
->Split Lines
(or pressCtrl + I
)
You may have to scroll horizontally to the start of the document but you will now have a "narrow" document.
I've absolutely no idea whether Notepad++ can do split lines to a predefined maximum number of columns (i.e. "split lines at 200 characters")
-
I will test this out on a real document, however using a garbage document, it appears that this works. To get the "fixed columns" a little trial and error might do the trick. I'll post back when i have a chance to test on the real thing.– NickJul 23, 2014 at 22:14
-
Ok, i tried it with a "real" document, and as expected, it "works" but doesn't handle indentations for numbered or bulleted lists– NickJul 25, 2014 at 16:00
-
I wouldn't expect it to either. A text document has no formatting so a bulleted list is cut and placed on a new line. You need a true word processor for advanced formatting. Jul 25, 2014 at 16:04
-
Agreed. We are using a word processor (MS Word). Trying to find the tool that can format .doc/.docx into fixed width/column text with proper indentation. I guess i can update the question to include that requirement (it is implied, not explicit).– NickJul 25, 2014 at 18:50
-
The method provided here is a bridge. It will do most of the heavy lifting. Thanks for this info.– NickJul 25, 2014 at 18:51
@Big Chris: The number of characters depends on the NP++ Window width. Try to resize it before pressing Ctrl + I
.
Microsoft-Word
indicating you have access to it.