What are the issues you're having with Calibre? I've found it to preserve the formatting I'm looking for. What formatting are you talking about that it's not preserving?
Hence most (if not all) programs export the text in the order they appear in the file.
And if it is scanned, there is no text at all (but you could OCR it).