cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

JSL to export a graph builder to image / ppt / pdf

Hi all,

 

Wondering if there is a JSL command group to export a graph to an image or pdf or ppt ? 

6 REPLIES 6
txnelson
Super User

Re: JSL to export a graph builder to image / ppt / pdf

See "Save Presentation" to save to a PowerPoint format, and Save PDF to save to a PDF.

Look in the Scripting Index for details and example

Jim

Re: JSL to export a graph builder to image / ppt / pdf

HI ,

thanks for the pointer. 

I used the following commands in JMP15 to save a graph into a pptx file based on a template file. These are from two data tables mean_report & noise_report

 

mean_report << Save Presentation(path(raw_mean_plot),Template(ppt_template), Outline Titles("None"), "PNG");

noise_report << Save Presentation(raw_mean_plot, Append, "PNG");

the raw_mean_plot is the file path for the pptx file along with file name, similarly ppt_template is the location of the template file along with the file path. 

While executing the above, after the first line a windows prompt opens up which requires me to define and store the location of the report file. The second graph is not saved to this ppt report file.  I would expect that these commands will help to store the first graph into a template pptx based on the one defined & append the graph from noise_report into the same. 

txnelson
Super User

Re: JSL to export a graph builder to image / ppt / pdf

  1. It is not interpreting your path as a valid path
  2. It is not interpreting your template path as a valid path
  3. Your Outline Titles element is not specified correctly
    1. Outline Titles specification does not accept a literal string, the value should be None     note "None"
    2. the PNG element is a second element of the Outline Titles element.  Therefore it should be   Outline Titles( None, PNG )

I suggest you start by not using any variable reference, but rather put in the literal hard coded paths, etc and get it to work.  Then start substituting in variable references.

You may have to use a Substitute methodology if the Save Presentation does not convert variable values the way you want

Jim

Re: JSL to export a graph builder to image / ppt / pdf

Hi Jim,

thanks for responding. 

 

Regarding your points below:

1. I am sure the path is valid. I also tried opening the path from the windows command and it's a valid return.  In fact it opens at the same directory in the Save Selection As popup as I had directed in the pptx file path, but somehow can't store on it's own . 

2. The template path is definitely valid as the new file stored after the pop up box is in the Template first slide's format. 

3. I'm referring to the command reference in help file at https://www.jmp.com/support/help/en/15.0/#page/jmp/display-boxes.shtml#ww2164087 as db<<Save Presentation(<path>, <Template(path)>, <Insert("Begin"|"End"|n)|Replace("Begin"|"End"|n)|Append>, <Outline Titles(title location)>, <format>). Believe this indicates that the PNG is not part of the Outlines Title.  Also PNG returns an error while "PNG" is accepted. Similarly "None" or literal None are both accepted.

 

Essentially I believe the command format is either missing something or not appropriate for JMP15 which seems the case in some of the other issues while scripting. Could you please also point me to Substitute Methodology documenation ? 

txnelson
Super User

Re: JSL to export a graph builder to image / ppt / pdf

The mismatch with your findings from my last entry was that I was using the Scripting Index for my syntax, which does not give the literal string options as the Help file does.  Sorry about that.

 

Here is an example of the code working.  It is without a template. It does not popup any path window.  I don't have a template, and my past experience with using the template resulted in never getting it to work....I assume that it is my lack of PowerPoint knowledge for my failure. But the cod does work.

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
raw_mean_plot = "$TEMP/jmp_example4.pptx";
rbiv << Save Presentation(raw_mean_plot ,outline titles("none"),"PNG") 
rbiv << Save Presentation(raw_mean_plot, append, "PNG")
Open( "$TEMP/jmp_example4.pptx" );

 

In your first example, you specify 

Path(raw_mean_plot)

I assumed you were using Path as a place holder for the actual path.  Is that the case?  The Path function in JSL is a graphical function.

Jim

Re: JSL to export a graph builder to image / ppt / pdf

Thanks for sharing your thoughts. I'm learning on the basis of the help file and hence wasn't very sure of the Scripting index, but good to know. 

 

Regarding the path, thanks for sharing this snippet. I too realized after the experiment that the result file has to be a valid pptx file existing in the location for it to work. The user cannot rely on JSL to create the pptx file in the valid location for the first time if the file didn't exist based on the template.  I was also erroneously keying in the keyword Path() just like the Outline Titles() which of course isn't valid. 

 

The template file option also works as long as you have another valid template file existing in the valid directory location. Here is an example which worked for me and I believe it would for you too in case you want to give it a try:  Please ensure you have a Template file, Template.pptx whose slide format is the way you would like it to be in your report and at least a blank mean_ppt.pptx. It just copies the same slide background/format to all the slides in the report and probably the user has to reformat each slide later on as desired. 

 

mean_report << Save Presentation("C:\Users\ReportFiles\mean_ppt.pptx", Template("C:\Users\TemplateFiles\Template.pptx"), Outline Titles(None), "PNG");