Rob van der Woude's Scripting Pages

Help text for Word2Any.cs

(view help text of Word2Any.cs as plain text)

Word2Any,  Version 1.02
Open a Microsoft Word document and save it in "any" (known) format

Usage:     WORD2ANY    "wordfile"  [ "outfile"  [ pages ] ]  [ options ]

Where:     "wordfile"  Word document(s) to be converted (wildcard "*" allowed
                       in file name, e.g. "name*.docx")
           "outfile"   output file(s) to be created (wildcard "*" allowed for
                       file name, e.g. "*.pdf" or "*.html")
           pages       page range to be saved (e.g. 5 or 1-3; default: all)

Options:   /O          silently Overwrite existing output file(s)
                       (default: abort or skip if output file exists)
           /T          list available output file Types
           /T:type     set output file Type (required if "outfile" is not
                       specified; type may be number or string)

Notes: [1] This program requires a "regular" (MSI based) Microsoft Word
           (2007 or later) installation, it will fail on an MS Office
           "click-to-run" installation
       [2] For Word 2007, to save as PDF or XPS, this program requires the
           "Microsoft Save as PDF or XPS Add-in for 2007 Microsoft Office
           programs", available at:
           http://www.microsoft.com/en-us/download/details.aspx?id=7
       [3] If wildcards are used in the Word file names, and the output file
           path is not specified, /T:type must be used, and the input file
           names should not contain dots.
       [4] If wildcards are used in the Word file names, and the output file
           path is specified, the output file name must be "*".
       [5] If wildcards are used in the Word file names, and the /O switch
           is not used, the program will display an error message in case an
           output file already exists, but it will then continue to convert
           the next file instead of aborting.
       [6] If a page range is specified, the selected pages will be copied
           and pasted to a temporary document, which will then be saved;
           this may affect page numbers.
       [7] If Word was already active when this program is started, any other
           opened document(s) will be left alone, and only the document(s)
           opened by this program will be closed.

Examples:  WORD2ANY "D:\folder\myfile.doc" *.pdf
           will save to "D:\folder\myfile.pdf"

           WORD2ANY "D:\folder\myfile.docx" "D:\otherfolder\*.rtf"
           will save to "D:\otherfolder\myfile.rtf"

           WORD2ANY "D:\folder\myfile.rtf" "D:\elsewhere\page3.xps" 3
           will save page 3 of "myfile.rtf" to "D:\elsewhere\page3.xps"

           WORD2ANY "D:\folder\name*.doc" *.html 1-2
           will save pages 1 and 2 of all matching files as HTML in "D:\folder"
           recognized extensions: htm, html, odt, pdf, rtf, txt, xml, xps

           WORD2ANY "D:\folder\*.doc" /T:8
           will save all matching files as HTML in "D:\folder"

           WORD2ANY /T
           will list all available file types

Credits:   Page range selection based on code by George Hua
           http://social.msdn.microsoft.com/Forums/office/en-US/e48b3126-
           941d-490a-85ee-e327bbe7e81b/convert-specific-word-pages-to-pdf-in-c

Written by Rob van der Woude
http://www.robvanderwoude.com

page last uploaded: 2017-03-25, 21:31