Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > Ectaco jetBook

Notices

Reply
 
Thread Tools Search this Thread
Old 02-25-2010, 09:49 AM   #1
steven522
binomial: homo legentem
steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.
 
steven522's Avatar
 
Posts: 981
Karma: 22661536
Join Date: Feb 2010
Location: Alabama, USA
Device: iriver Story HD; Archos 80 G9
Using MS Word to quick-reformat text

Don't know if this will be helpful to you unless you have a version of MS Word.

I had several plain text files with lots of short stories in them that had been force-formatted to a max of 60 characters across with CRLF terminations. Looking at these on the jetbook made for an interesting read.

Connecting the jetbook to the PC directly, I edited the files on the SD card from with in Word to remove the extra "enters" on each line. Luckily, the original creator had followed each paragraph with a double "enter" to leave a blank line in-between.

I setup a macro within Word to do the following:
- Search for every paragraph/"enter" (in Word represented as "^p") within the file and replace with a space.
- Search for every double-space, which would be the "enter"-"enter" between paragraphs, and replace with the same "enter"-"enter" ("^p^p" within Word).

With this, I was able to load the file, launch the macro (button or key combo), and then save the file. Took about 5 seconds per file total. I went through the entire folder in few minutes.


Macro code is below for any cut-and-paste'ers out there:

Code:
Removed old code for newer code directly below

Last edited by steven522; 02-26-2010 at 11:03 AM.
steven522 is offline   Reply With Quote
Old 02-26-2010, 11:02 AM   #2
steven522
binomial: homo legentem
steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.steven522 ought to be getting tired of karma fortunes by now.
 
steven522's Avatar
 
Posts: 981
Karma: 22661536
Join Date: Feb 2010
Location: Alabama, USA
Device: iriver Story HD; Archos 80 G9
Made an improvement to handle some formats that use spaces instead of tabs to indent that was causing issues with some file conversions.


Code:
Option Explicit
Sub ReformatText()
    ' ReformatText Macro
    
    '  Replace all CRLF (paragraph) with "~~" marker
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = "~~"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    '  Replace all double "~~" markers with a double
    '  CRLF (paragraph) format code
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "~~~~"
        .Replacement.Text = "^p^p"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
    '  Replace all remaining "~~" markers with a space
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "~~"
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    
End Sub
steven522 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does conversion reformat the text? dynalmadman Calibre 0 02-20-2010 08:33 PM
Text to Speech - Word Missup. DrakeShockFire Amazon Kindle 6 02-10-2010 12:06 AM
Quick n' dirty Ruby Program: convert text files (Kindle - others?) monojohnny Reading and Management 5 01-14-2009 08:32 AM
text reformat ShacharWeis Workshop 6 09-04-2008 07:51 AM
Used MS Word for a quick blog conversion anotherchance Sony Reader 0 10-23-2007 01:37 PM


All times are GMT -4. The time now is 07:37 AM.


MobileRead.com is a privately owned, operated and funded community.