WPCubed Product Support

Load from DOCX - Font

Hello,

i licensed the docx plugin which works well for importing a docx template. Just the font of the template is always replaced by Arial also if I set the font as base font of the WPRichtect before and after loading the docment. I would be grateful if you could help me understand what I have to do.

#1 ♥ 0
5.4k Views 2 users read 1 min
wpsupport

If have tried this code:

   WPRichText1.Clear;
   WPRichText1.DefaultAttr.SetFontName('Courier New');
   WPRichText1.WritingAttr.Clear;
   WPRichText1.InputString('Test');

After saving to DocX the file was ok.

#2 ♥ 0

This is what I do:

  wp.Clear;
  wp.DefaultAttr.SetFontName('Raleway');
  wp.WritingAttr.Clear;
  wp.loadfromfile(changeFileExt(application.exename, '.docx'));
  wp.MergeTextEx('', '', wpobjBookmark, [wpmergeAllTexts]);

So the code helped a lot. But I would like to get rid of having to set the default font. It does not use the fonts from the docx file. Am I missing something? If I omit setting the Font, it uses Arial.

#3 ♥ 0
wpsupport

Without example I cannot tell - the DocX reader has code to read DocX defaults. But in your file this may not work.

#4 ♥ 0
This category is archived. No new posts are possible.