Exporting Numbers documents is done using the export command from the Numbers Suite.
exportv : Export a presentation to another file(s).
exportdocument : The presentation to export.
to (file ) : A reference to the file (folder) to be created. When exporting images or HTML, a new folder, containing the exported items, is created instead of a file.
as ( PDF / Microsoft Excel / CSV / Numbers 09 ) : The format in which the document is to be exported.
[ with properties (export options ) ] : An AppleScript record containing property:value pairings for the initial values for properties of the exported object.
export optionsn : The export options for the Numbersexport command.
properties
exclude summary worksheet ( boolean ) : (Numbers 3.6) Whether to exclude a summary worksheet in Excel workbook.
image quality ( good/better/best ) : (Numbers 3.6) The quality of the images in the exported PDF file.
password ( text ) : The password to use when the exported PDF is encrypted.
password hint ( text ) : The password hint.
NOTE: The Numbers version 3.6 scripting dictionary includes enhanced export options for exporting to Excel format, as well as image compression options for images placed within the exported document.
Export Scripts
The following are script examples for each of the export types:
This script exports the frontmost Numbers presentation to a PDF file. Set the boolean value of the useEncryptionDefaultValue property to either true or false to determine whether you will be prompted for the password to use in encrypting the PDF file.
Export to PDF
01
propertyexportFileExtension : "pdf"
02
propertyuseEncryptionDefaultValue : true
03
04
-- THE DESTINATION FOLDER
05
-- (see the "path" to command in the Standard Additions dictionary for other locations, such as movies folder, pictures folder, desktop folder)
06
set thedefaultDestinationFolderto (path todocuments folder)
07
08
setusePDFEncryptiontouseEncryptionDefaultValue
09
tellapplication "Numbers"
10
activate
11
try
12
if not (existsdocument 1) then errornumber -128
13
14
ifusePDFEncryptionistruethen
15
-- PROMPT FOR PASSWORD (OPTIONAL)
16
repeat
17
display dialog "Enter a password for the PDF file:" default answer ¬
18
"" buttons {"Cancel", "No Password", "OK"} ¬
19
default button 3 withhidden answer
20
copy theresultto ¬
21
{button returned:buttonPressed, text returned:firstPassword}
22
ifbuttonPressedis "No Password" then
23
setusePDFEncryptiontofalse
24
exit repeat
25
else
26
display dialog "Enter the password again:" default answer ¬
27
"" buttons {"Cancel", "No Password", "OK"} ¬
28
default button 3 withhidden answer
29
copy theresultto ¬
30
{button returned:buttonPressed, text returned:secondPassword}
Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. MACOSXAUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. MACOSXAUTOMATION.COM provides this only as a convenience to our users. MACOSXAUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and MACOSXAUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from MACOSXAUTOMATION.COM and that MACOSXAUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.