
: 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 want to paginate an ePub file based on how many words are there per page, then to insert the "page numbers" into the ePub file. In this case, I will have the same page numbers while I read this file on different devices.
Is there a way to achieve this? Thanks!
Free books android app tbrJar TBR JAR Read Free books online gutenberg
More posts by @Sherry

: ToC: Errors Thrown I'm trying to fix a table of contents with the following code and am am getting this error: "Error at line 20 at column 8: Opening and ending tag mismatch li line 0 and

: Epub without a Table of Contents, is it possible? Ideally, I'd like to not have a ToC. But I understand that without one, an epub won't validate. Is there any way to create a ToC with no
1 Comments
Sorted by latest first Latest Oldest Best
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