
: Re: How to insert calculated page numbers based on word counting into an ePub file? I want to paginate an ePub file based on how many words are there per page, then to insert the "page numbers"
I figured out a way to do this. It
s not a perfect solution, but it works!
The idea is that I convert a ePub file to a Word file using calibre. I then use the Macros function of the Microsoft Word to insert the calculated "page numbers" into the text. Finally, I convert the modified Word file back to a ePub file using calibre again.
Here is the code if you are interested in. Please google it if you do not know how to use the Macros function. It's simple.
Modify the code to suit your purpose:
In this code, I define a page has 300 word. You can change it to whatever you want.
The page number looks like "8 ". You can change it to other format like "(8)"...
Sub DemoWords()
Application.ScreenUpdating = False
Dim Rng As Range, i As Long, j As Long, k As Long, w As Long
Const l As Long = 300 'Word per page, now 300
With ActiveDocument
Set Rng = .Range(0, 0)
With .Range
For i = 1 To .Words.Count Step l
Rng.MoveEnd wdWord, l
With Rng
.Collapse wdCollapseEnd
.InsertBefore "__" & Round(i / l) + 1 & "__ "
.Collapse wdCollapseEnd
End With
Next
End With
End With
Application.ScreenUpdating = True
End Sub
Free books android app tbrJar TBR JAR Read Free books online gutenberg
More posts by @Martha

: How to Open pdf, ncx, opf files? I have an ebook downloaded from my university elearning site, it was downloaded, not online reading. But it can only be opened and readed from university's

: Kindle doesn't show cover I just got a kindle as Christmas present. I got myself calibre and loaded 4 E-Books on my kindle. I can open and read every book, but unfortunately I just can see