21
Publishing from JMP Catherine Hosage Norman, Ph.D.

Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Publishing from JMP

Catherine Hosage Norman, Ph.D.

Page 2: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Publishing

• Produce or release for distribution

• Implies print but also implies layout

• Typical approach is to copy & paste into Word

– repetitive task

• Table to word, first layout, then copy & paste

• Run report and then cut & paste graphics

• Both require formatting in Word

9/14/2014 2

Page 3: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Programmatic Approach

• Involves using JMP objects and functions to manipulate Office Open XML products via:

– Microsoft XML SDK

– PowerShell

– Or any .NET language

– PowerTools 2.2- library of command line calls

9/14/2014 3

Page 4: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Office Open XML

• XML standard format for office applications • Also known as OOXML or Open XML not to be

confused with Open Office • History – started 1998 with the Beta version of

Office 2000 released with HTML support in Word, PowerPoint, and Excel.

• 2007 - Ecma standard and submitted to ISO • File extensions on Word, Excel, PowerPoint etc.

changed and added x at the end – .doc => .docx

9/14/2014 4

Page 5: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Structure of the Open XML Formats

• Start part - uppermost part in the hierarchy

• XML parts - Files or folders consisting of XML files that contain the content

• Non-XML parts - usually images or OLE objects

• Relationship part - XML files that define the relational hierarchy of the parts

• ZIP package - Packs the parts into a single file

9/14/2014 5

Page 6: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Packaging Conventions

• Simplest term – a directory structure

• Excel file structure as an example

9/14/2014 6

Page 7: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

The ZIP Archive

• JMP object that allows direct access to Open XML directories

• Rename any Open XML file extension to .zip and extract the parts

• ZipArchive object operates directly on a zip file

9/14/2014 7

Page 8: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

JMP XML Gateway Commands

• Web – Opens a URL or stored file

• ZipArchive object

• Utility commands-Copy File

• XML Encode – formats text as XML fragment

• Parse XML – Parses XML and triggers events

• XPath Query (new 11)

9/14/2014 8

Page 9: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Demonstration

• Extract comments and comment authors from Excel file

• Information found in: .\filename\xl\ comments1.xml

.\filename\xl\ comments2.xml

• za = Open( "C:\Temp\wrkExcelasXml.zip", zip );

• Link to JSL

9/14/2014 9

Page 10: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Writing to Word

• Simple case of updating monthly report with new graph

• Requires PowerShell

• Write function of ZipZrchive does not copy over existing file and appears to turn the image into text

9/14/2014 10

Page 11: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

PowerShell

9/14/2014 11

• Task-based command-line shell and scripting language

• Designed for system administration

• Built on the .NET Framework

• Scripts control and automate administration of Windows OS commands and applications

• Built-in Windows PowerShell commands are called cmdlets

• Accesses data stores e.g. registry and certificate store

• In this case - the file system

• Expression parser, scripting language and ISE

Page 12: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Accessing PowerShell

• Start menu widows 7

• >Accessories > Windows PowerShell

• Downloadable earlier versions of Windows

9/14/2014 12

Page 13: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Example Structure of ps1 file

9/14/2014 13

Page 14: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Task – Update Graph in Word

• File to be updated

• File directory

• JMP Script demo

• .bat file as glue between JMP and PowerShell

• Image files created

• Word file created by copy and paste

9/14/2014 14

Page 15: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Creating Word Documents

• Last example edited an existing document

• Drafting a .docx file requires more

• Requires Open XML SDK for Office

• Access API via any .NET language like vb

• PowerShell cmdlets known as PowerTools

9/14/2014 15

Page 16: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

PowerTools

• Started at Microsoft circa 2008

• Version 2.2 last version to support cmdlet interface released Jan 2012

• Now a CodePlex project

• Encapsulates common document building function in to simple PowerShell command line calls

• http://powertools.codeplex.com/

9/14/2014 16

Page 17: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Task – Write JMP

table to Word

xml structure for a table in a .docx file

9/14/2014 17

Page 18: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Creating XML in JMP

• Excellent example of creating a file in JSL Companion, Utlaut, Morgan and Anderson

• Adapted to script that transposes a JMP table into a standard stability report layout

• Originally pasted the layout into Word

9/14/2014 18

Page 19: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Task Objective

9/14/2014 19

Page 20: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Demo Writing DOCX

• JMP script

• Resulting xml file

• PowerShell Script

• Resulting word file

9/14/2014 20

Page 21: Publishing from JMP · Office Open XML •XML standard format for office applications •Also known as OOXML or Open XML not to be confused with Open Office •History – started

Conclusion

• Automating the Publishing JMP output is possible

• Has it challenges

• Worth the effort for repetitive reporting tasks

9/14/2014 21