Skip to main content
Participant
November 2, 2023
Answered

Tables not exporting the same visually in an Ebook file from inDesign

  • November 2, 2023
  • 1 reply
  • 317 views

Hi all. I’m learning to make ebooks in inDesign and work gave me a project that is full of data tables.


Googling “tables” keeps bringing up TOC stuff.

Visually they look correct in inDesign, but when I export the file, there’s weird strokes in varying columns that are different styles and weights and some of them are different sizes… I’m already not an expert on making ebooks, so I’m at a loss as to what to do. Someone else suggested just making an image and dropping it in. It’s not imperative that the text is interactive.

I wanted to try to learn to do this by myself since I don’t have anyone in the office to help me but the deadline is coming and I don’t know what I’ve done wrong. The table was originally placed from a word document and it had all kinds of weird colors and strokes applied to it that I had to fix, I wouldn’t be surprised if that’s part of the issue. Any advice?

This topic has been closed for replies.
Correct answer James Gifford—NitroPress

Tables can be very difficult to reproduce in straight export, because InDesign simply does not do a very good job of translating its Table and Cell styles to HTML/CSS code (the basis for EPUBs as well as web pages).

 

You can keep tables very simple, with consistent strokes defined for both the Table and Cell styles — and you really must use styles here, not any kind of default setup or spot overrides on the styling — and for the text within the table. Trying to get too fancy with thicker strokes, tinted cells, etc. means your export will probably have flaws. (You can get fancy... but it takes a lot of skill with what follows.)

 

The real secret to getting clean, even 'fancy' tables to EPUB is to use CSS style overrides at the export. If you're short on time and don't have some web development experience, that may not help (in time). My book (in the sig below) goes into complete detail, but that won't help much if you don't have the time to absorb the info. Here, however, is a very basic set of CSS for clean, simple tables:

 

table.Plain-Table {
width: 100%;
border: 1px red solid;
margin-top: 30px;
margin-bottom: 30px;
}
td.Plain-Table {
border: 1px blue solid;
padding: 2px;
epub-hyphens: none;
}
p.TABLE-body, p.TABLE-head {
font-family: sans-serif;
font-size: 0.8rem;
margin: 0;
padding: 0;
text-indent: 0;
}
p.TABLE-head {
font-weight: bold;
padding-top: 2px;
}

 

 

You will need to create matching styles for your document —

  • Table style Plain Table
  • Cell style Plain Table
  • Paragraph styles TABLE body and TABLE head

...and apply them to all your table elements.

 

Then put the above code in a text file (use Notepad or equivalent), call it MyTables.css, and include it in the export menu for your EPUB under "additional CSS".

 

That's pretty dense; happy to answer further questions. Unfortunately, tables are one area where there is no really simple way to get a good result... this is the simple version. 😛

 

Note that this assumes a reflowable EPUB. If you're exporting to fixed-page EPUB (FXL) it may or may not work as well.. but FXL is a cranky, obsolete format and should not be used for text documents anyway.

1 reply

James Gifford—NitroPress
Legend
November 2, 2023

Tables can be very difficult to reproduce in straight export, because InDesign simply does not do a very good job of translating its Table and Cell styles to HTML/CSS code (the basis for EPUBs as well as web pages).

 

You can keep tables very simple, with consistent strokes defined for both the Table and Cell styles — and you really must use styles here, not any kind of default setup or spot overrides on the styling — and for the text within the table. Trying to get too fancy with thicker strokes, tinted cells, etc. means your export will probably have flaws. (You can get fancy... but it takes a lot of skill with what follows.)

 

The real secret to getting clean, even 'fancy' tables to EPUB is to use CSS style overrides at the export. If you're short on time and don't have some web development experience, that may not help (in time). My book (in the sig below) goes into complete detail, but that won't help much if you don't have the time to absorb the info. Here, however, is a very basic set of CSS for clean, simple tables:

 

table.Plain-Table {
width: 100%;
border: 1px red solid;
margin-top: 30px;
margin-bottom: 30px;
}
td.Plain-Table {
border: 1px blue solid;
padding: 2px;
epub-hyphens: none;
}
p.TABLE-body, p.TABLE-head {
font-family: sans-serif;
font-size: 0.8rem;
margin: 0;
padding: 0;
text-indent: 0;
}
p.TABLE-head {
font-weight: bold;
padding-top: 2px;
}

 

 

You will need to create matching styles for your document —

  • Table style Plain Table
  • Cell style Plain Table
  • Paragraph styles TABLE body and TABLE head

...and apply them to all your table elements.

 

Then put the above code in a text file (use Notepad or equivalent), call it MyTables.css, and include it in the export menu for your EPUB under "additional CSS".

 

That's pretty dense; happy to answer further questions. Unfortunately, tables are one area where there is no really simple way to get a good result... this is the simple version. 😛

 

Note that this assumes a reflowable EPUB. If you're exporting to fixed-page EPUB (FXL) it may or may not work as well.. but FXL is a cranky, obsolete format and should not be used for text documents anyway.

Participant
November 2, 2023

This is helpful, thank you! Should I just delete all the styles I already created? Is there a way to reset a table to just "default"?

James Gifford—NitroPress
Legend
November 2, 2023

Work from a copy so you don't irretrievably lose anything, but yes, deleting all unused styles is a good idea for EPUB export.

 

Grab each table and apply the new Table style and make sure the new Cell style is applied, without overrides, to every cell. Make sure the head and body Table paragraph styles are applied, again without overrides. You can judiciously expand this style set once you get to clean, basic tables in the output. The styles in ID are theoretically irrelevant if you do enough CSS styling to override them, but it's best to adjust the styles to a similar look and then just tweak in CSS.

 

The key is getting all those extra styles, overrides, spot formatting etc. out of the way so that only your defined styles are in use, and those are used consistently.