Import Word in a special way

General TRichView support forum. Please post your questions here
Post Reply
starhu
Posts: 49
Joined: Fri Jan 17, 2014 6:33 pm

Import Word in a special way

Post by starhu »

Hello,

I need to accomplish the following:

-The user chooses a Word files to import in ScaleRichView

- During the import I should change the Font type and the font size (e.g. in the Word it was Times Roman 12, but in the ScaleRichView it should be Arial 10)

- The paragraph alignment should be changed too (e.g. in the Word it was Justify, but in the ScaleRichView it should be Left)

-The regular and bold parts should have a special style. This means for example that a word which was bold will stop being bold in ScaleRichView, but it will be a pre-defined style e.g. MyBoldStyle

- The margins should not change (the margins should have the values of the original ScaleRichView document).

Is there a way to import Word documents in ScaleRichView?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

First, it's better to use RTF.
DocX files can be imported using TRVOfficeConverter, but some formatting may be lost in this way.

Next, you can load in a hidden TSRichViewEdit first, then modify collections of styles. Then save to a memory stream using SRVHidden.RichViewEdit.SaveRVFToStream, and then load to the final editor using SRV.RichViewEdit.InsertRVFFromStream.
Post Reply