How to keep spacing when converting file from plain text to rich text?
Hi everyone. I have a file that comes out of really old software as .txt. It’s a list of names dates and times which are neatly arranged in columns while in plain text. I need to convert to rich text and when I do that I lose the columns.
Is there a way to preserve the exact look of the .txt file but in rich text?
Not really a Notepad++ question – at least, I don’t know of a plugin in NPP that converts from plaintext to RTF (though it wouldn’t surprise me if there were one). But a quick search for “columns in rtf” lead me to a tutorial at http://www.pindari.com/rtf3.html and to http://stackoverflow.com/questions/5245630/setting-column-width-in-rtf, which might start pointing you in the direction of how to create a RTF table (and thus, a column).
Other than rolling your own, or using the NPP plugin I don’t know about, you might consider something like a spreadsheet application, which can read a fixed-width text file as a spreadsheet, and can save to RTF; or use a scripting language, like Perl with its modules Text::CSV and RTF::Writer, or I assume there’s something similar for Python or your other favorite scripting language of choice.
But I’m guessing a spreadsheet application would be your best bet for quick conversion of fixed-width tabular text into tabular RTF.
First check if your original text file uses spaces or tabs.
View --> Show Symbol --> Show White Space and TAB
You can force spaces by selecting all text and:
Edit --> Blank Operations --> TAB to SPACE
Or force tabs with:
Edit --> Blank Operations --> Space to TAB (ALL)
Force spaces, copy to RTF editor. In your RTF editor, switch to monospace font (Courier new) that should fix it.
Search and replace multiple tabs: \t+ to single tab \t.
copy to RTF editor.
Your RTF editor (MS Word?) may allow you to align the tab as you want.
Have you tried
Right click -> Plugin commands -> Copy Text with Sintax HighlightingOr the same option from the menu:
Plugins -> NppExport -> Export to RTFor
Plugins -> NppExport -> Copy RTF to clipboard
You have to select the text you want to export, it will work with simple text files too. You can do the first option and then copy in word for example.
When you “convert to rich text” I’m assuming you’re pasting the data into something else (Word?). I think all you need to do to maintain the columns is set the font on the pasted data to a fixed-width font like courier.