I'd like to create e-book files in the .epub format. I already have the text with some formatting (as .html, .doc, .rtf etc.), and I need an editor (preferably WYSIWYG) in which I can make these changes: fix formatting, fix spelling of some words, add chapters and sections, add a table of contents, add .epub metadata (e.g. title, author) etc. I'd like to save the final output as an .epub.
I know about the writer2epub LibreOffice extension (and I've heard about similar ones). My primary problem with it that in LibreOffice (and OpenOffice) it's possible to make formatting changes which would be ignored in the .epub export. So at the moment I change something I have no idea if it would affect the final .epub, and how I should make my change to have the desired effect on the final .epub. I'd prefer a software which shows the .epub version in a WYSIWYG way after each change.
I'd also like to edit existing .epub files to fix formatting and spelling errors, reduce the resolution of the images etc. I'd like to keep the original structure of the book, but make some local changes, keeping everything I don't change intact.
Which software do you recommend?