Support MHT and DOC files

General TRichView support forum. Please post your questions here
Post Reply
snike555
Posts: 14
Joined: Thu May 06, 2010 10:18 am

Support MHT and DOC files

Post 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)
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
snike555
Posts: 14
Joined: Thu May 06, 2010 10:18 am

Post 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.
snike555
Posts: 14
Joined: Thu May 06, 2010 10:18 am

Post by snike555 »

up
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply