ToWrdPlot.Rd
Evaluate given plot code to a tiff()
device and imports the created plot in the currently open MS-Word document. The imported plot is marked with a bookmark that can later be used for a potential update (provided the bookmark name has been stored).
ToWrdPlot(plotcode, width = NULL, height = NULL, scale = 100,
pointsize = 12, res = 300, crop = 0, title = NULL,
wrd = DescToolsOptions("lastWord"),
bookmark = gettextf("bmp%s", round(runif(1, min = 0.1) * 1e+09)))
code chunk needed for producing the plot
character, the name of the bookmark
the width in cm of the plot in the Word document (default 15)
the height in cm of the plot in the Word document (default 9.3)
the scale of the plot (default 100)
the default pointsize of plotted text, interpreted as big points (1/72 inch) at res
ppi. (default is 12)
the resolution for the graphic (default 300)
a vector of 4 elements, the crop factor for all 4 sides of a picture in cm (default all 0)
character, the title of the plot to be inserted in the word document
the pointer to a word instance. Can be a new one, created by GetNewWrd()
or an existing one, created by GetCurrWrd()
.
Default is the last created pointer stored in DescToolsOptions("lastWord")
.
An old and persistent problem that has existed for a long time is that as results once were loaded into a Word document the connection broke so that no update was possible. It was only recently that I realized that bookmarks in Word could be a solution for this. The present function evaluates some given plot code chunk using a tiff device and imports the created plot in a word document. The imported plot is given a bookmark, that can be used afterwards for changing or updating the plot.
This function is designed for use with the DescToolsAddIns functions ToWrdPlotWithBookmark()
and ToWrdWithBookmark()
allowing to assign keyboard shortcuts. The two functions will also insert the newly defined bookmark in the source file in a format, which can be interpreted by the function UpdateBookmark()
.
a list
a windows handle to the inserted plot
a windows handle to the bookmark