Page 1 of 1

Support MHT and DOC files

Posted: Fri May 07, 2010 4:22 am
by snike555
I want to open in file editor TRichView files like *.mht or *.doc for reading only.Is this possible in some way?
I wanted to use *.rtf files but there are some problems with transfering information from *.doc files.
I tried to transfer text and imagesfrom *.doc but I realised that there is no support for *.png imafes. I have tried to exchange *.png for *.jpg but zoom is horrible. (Microsoft Word do it much better)

Posted: Sat May 08, 2010 6:03 pm
by Sergey Tkachenko
1) For reading MHT, you need to parse it into HTML and images, then load this HTML using TrvHtmlViewImporter or TrvHtmlImporter.
To parse MHT, you can use components supporting MIME files (sorry, no example yet, I'll try to make an example with clevercomponents soon)
For loading DOC files, only TrvOfficeConverter component can be used. However, RTF is still used internally, and results are generally worse when loading RTF files saved by MS Word.

2) Which kind of problems are for transferring from DOC to RTF? DOC and RTF can contain the same information - RTF is just a text version of DOC. RTF can contain PNG images.
As for using PNG images in TRichView, see http://www.trichview.com/forums/viewtopic.php?t=89
As for scaling images, the current version of TRichView just uses Graphic.StretchDraw, so quality of drawing may be not very good. But it has nothing common with data conversion.
Improving drawing of stretched images is planned for future.

Posted: Tue May 11, 2010 5:29 am
by snike555
We don't use RTF files, becouse they very big with images.
I looked at the demo project with "OfficeConverters", but can't opened MS Word *.doc (97-2003) documents.

Posted: Tue May 25, 2010 3:47 am
by snike555
up

Posted: Tue May 25, 2010 7:17 am
by Sergey Tkachenko
Older versions of TRichView have problems opening DOC files if Word 2007 is installed. Version 12 fixed this problem. But make sure that you choose the right converter. There are 2 different types of doc files:
- for Word 6
- for Word 97 and newer.
Different converters are required to open them.

As for storing pictures in RTF, it can be even more efficient than in MHT.
MHT uses Base64 encoding, increasing picture size by 33.3% (each 3 bytes are encoded in 4 bytes).
By default, RTF encode pictures as hexadecimal data, increasing picture size by 100%. However, if you save them in TRichView, you can include rvrtfSavePicturesBinary in RTFOptions property, and pictures will be saved exactly as they are, without any redundancy.