Saving multiple graphs to rtf

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Posts: 10
Joined: Fri Sep 08, 2017 2:38 am

Saving multiple graphs to rtf

Postby nilslh » Mon Sep 11, 2017 8:16 am


I have a question regarding the options when saving multiple graphs to rtf. At the moment I have a lot of graphs that I would like to export to a Word document. I have tried to create a spool object for all the graphs and then save as rtf. The problem is that all graphs are saved on individual pages and I cannot find any options about exporting, say, six graphs per page. Is there any way of programming around this problem and choose to export six graphs per page to one document?

One option is to merge the graphs per some defined group, but I would like the code to be more general in order to make it sustainable for future revision. Below is my current code for this option where I group according to a desired group structure. However, then all the figures for the groups are merged and exported to one individual page in Word.

Code: Select all

For %A {%Age}
  For %S series01 series02
    %Gr_{%S} = %Gr_{%S} + " " + "Dia1" + %S + %A + "s"    ' Here I refer to graphs for the first group
  For %S series03 series04 series05
    %Gr_{%S} = %Gr_{%S} + " " + "Dia2" + %S + %A + "s"   ' Here I refer to graphs for the second group

Spool Dia
For %S {%Ser2}
  Graph mydia{%S}.merge {%Gr_{%S}}
  Dia.append mydia{%S}

Dia.Save(T=rtf, Mode=C) {%Dir}AKU

Thank you!

Nils Landén

EViews Jason
EViews Developer
Posts: 718
Joined: Tue Sep 16, 2008 3:50 pm

Re: Saving multiple graphs to rtf

Postby EViews Jason » Mon Sep 11, 2017 9:47 am

Unfortunately there isn't anything you can do within EViews when using RTF.

When writing to RTF, EViews stores graph images in Windows Metafile Format (WMF). WMF is scaleable image format. Being a scaleable image format, you will have to resize each image from within MS Word. This can be done by selecting image (in Word) and then dragging one of the corners. Word will then fit as many images as possible on the same page. This is understandably inefficient, but at least you can resize the images and get the desired output.

You could alternatively save each individual graph (not the spool) with a specified size in a different format such as png or bmp and then 'import' those files into your Word document.

Posts: 10
Joined: Fri Sep 08, 2017 2:38 am

Re: Saving multiple graphs to rtf

Postby nilslh » Tue Sep 12, 2017 4:16 am

I figured out a way around the problem by grouping the figures and then merging before assigning them to a spool object. However, the (merged) figures are right aligned in the rtf when I would like them to be centered. When exporting to a pdf the figures look very nice except that all the titles, axes etc. are printed in very, very small letters... When I look at the spool in Eviews it looks fine. Does anyone know a solution to this problem?

example.png (14.08 KiB) Viewed 863 times

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests