Prepare Your File For Sigil

If you already have an EPUB or HTML file, or are writing from scratch in Sigil, you can skip this step.

If you are starting with a document created by a word processor, then the first thing you need to do is convert your document to HTML so that you can import it into Sigil. Some programs can generate EPUB files as output. And some programs have add-ons or features to clean up their HTML output. Whether it is best to use the HTML or EPUB (or even plain text) output of these programs depends on the program – you can always test different ways to see what works best.

The "cleaner" your HTML file is, the easier it will be to turn it into an EPUB and the more likely it will display correctly on multiple devices. This means using styles for formatting and not using too many fancy formats and layouts.

Do not expect an EPUB to look like a printed book – EPUB is designed so that the reader can control how the book is displayed.

Although conversion is not part of Sigil, here are some suggestions for converting files for importing into Sigil.

Word Documents

Use the MS Word menu item File→Save As Filtered HTML. Or use the MS Word Macro @ MobileRead.

Both approaches try to reduce the amount of extra code exported by MS Word so that your HTML file is cleaner and simpler to edit in Sigil. You really want to have your code as clean as possible since Word adds lots of extra HTML tags that you will probably want to delete at some point.

When using Word or any word processor, you should always try to use styles to format your code instead of just making some text bold, some larger, etc. Styles are also an important concept when formatting EPUBs.

There are numerous sites on the Internet that deal with converting MS Word files for use in EPUBs. Here are just a couple:

There are also free apps available from both Microsoft and Apple that automate the process for you.

Word-to-epub-converter
The Document Converter

DOCXImport Plugin

To create a new EPUB book directly from a MS Word file you can use the DOCXImport plugin developed by DiapDealer. By adding this plugin you can directly import a docx into Sigil as html.

DOCXImport plugin (See the Manage Plugins chapter on how to install a plugin).

Note: Using this plugin will create a new EPUB. If you already have an existing EPUB open in Sigil this will be replaced and any unsaved work will be discarded.

Click on Plugins→Input→DOCXImport to run the plugin.

spellcheck-main

Prior to selecting the file to import you have the option of choosing which version of EPUB your book will be, and also whether to use a custom Style Map or Stylesheet.

spellcheck-main

Click on DOCX File to import and then select the file you wish to import.

spellcheck-main

Heed the warning!

spellcheck-main

The docx file after successful importation and conversion ready for editing.

spellcheck-main

Text Files

It is not strictly necessary to convert text files to HTML. Sigil can directly open .txt files.

Text files must have a blank line between paragraphs so that Sigil can split them into separate paragraphs.

Text files are not an ideal source, but they can still be better than some formats as they will have fewer unnecessary HTML tags. They may be worth using if you have lots of issues with other formats. Sometimes it is faster to add styles to a clean document than to try to clean up a converted file.

Other Formats

Many other word processors, such as LibreOffice, also have a save-as or export to HTML or even save-as EPUB function that you can try. As with MS Word good advice on this process can be found on the Internet.

You can also convert other formats to HTML or EPUB using other software such as Calibre.

Note that any automatic conversion of your files will introduce lots of extra code. If you are just formatting a book for personal use you may not be concerned with this. But if you are formatting books for professional purposes or want as little extra code in your EPUB as possible, then it should be avoided.

Sigil only supports importing HTML files since converting from other formats is actually quite specialised and best left to other tools.