Page 1 of 1

Import Word in a special way

Posted: Fri Mar 21, 2014 9:19 am
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?

Posted: Fri Mar 21, 2014 10:49 am
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.