0

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.

4
  • Just use Word and adjust the page margins.
    – Ramhound
    Jul 23, 2014 at 16:05
  • That would work if we had MSWord (or compatible) available everywhere, but then whe wouldn't need txt file format.
    – Nick
    Jul 23, 2014 at 22:10
  • I meant. Use word to sent the margins then wave it was a RTF. You tagged this as Microsoft-Word indicating you have access to it.
    – Ramhound
    Jul 23, 2014 at 22:12
  • Yes, I do have access to MSWord to generate the plan text document that we want. Plain text is the required output.
    – Nick
    Jul 25, 2014 at 16:01

2 Answers 2

3

Using Notepad++'s Split Lines functionality can do this for TEXT files.

  1. 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.
  2. Resize your Notepad++ window to how wide you want the new "width" to be
  3. Ctrl + A to select your entire document
  4. Click Edit -> Line Operations -> Split Lines (or press Ctrl + 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")

5
  • 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.
    – Nick
    Jul 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
    – Nick
    Jul 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.
    – Kinnectus
    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).
    – Nick
    Jul 25, 2014 at 18:50
  • The method provided here is a bridge. It will do most of the heavy lifting. Thanks for this info.
    – Nick
    Jul 25, 2014 at 18:51
-1

@Big Chris: The number of characters depends on the NP++ Window width. Try to resize it before pressing Ctrl + I.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .