# 2.7.15 expPDFw

File : Export : As Multipage PDF File

## Brief Information

Export worksheet as multipage PDF file

Minimum Origin Version Required: 8.1 SR0

## Command Line Usage

1. expPDFw export:=book filename:=<Long Name> path:="C:\My PDF Files" overwrite:=ask;

2. expPDFw export:=active filename:="<long name>" path:=D:\ overwrite:=ask
tr2.PDF.pdf.ColorTranslation:=0. tr2.PDF.pdf.LineMode:=0.  tr2.PDF.Compression.ClrImageCompression:=0. tr2.MultiPage.CoverPage.Text:="My Report"
tr3.Check.Chk_Horz_Grids:=0. tr3.Check.Chk_Vert_Grids:=0. tr3.Check.Chk_Frame:=33554432.;



## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Select Sheet(s) export

Input

int

0

This variable is used to specify the page(s) to be exported. The default option is Current Sheet. Option list:

• active:Current Sheet
Current worksheet will be exported.
• book:Sheets in Book
All worksheets in the active workbook will be exported.
• folder:Sheets in Folder
All worksheets in the current folder will be exported, not including those in subfolder(s).
• recursive:Sheets in Folder (Recursive)
All worksheets in the current folder will be exported, including those in subfolder(s).
• project:Sheets in Project
All worksheets in the project will be exported.
• specified:Specified
Export the worksheet specified in the Worksheets text box.
Worksheets pages

Input

string

<active>

List the worksheets to be exported. When Specified is selected in the Export drop-down list, this field is editable. Also the Browse button will be enabled. Click the Browse button to open the Project Browser Sheets dialog to select the worksheets to be exported.

File Name(s) filename

Input

string

Specify the name(s) for the exported PDF file(s). Options include:

• <Long Name>
Use the long name of the worksheet as the file name.
• <Short Name>
Use the short name of the worksheet as the file name.
• <Sheet Name>
Use the sheet name of the worksheet as the file name.
• wks##
Use "wks + index" as the file name.
• wks<pound>#
Use "wks# + index" and character "#"(represented by <pound>) as file name.

Note:

1. File Name supports keyword combination, such as <longname>-multi, the long name of the worksheet and the string -multi will be used as the export file name.
2. <pound>, representing the character "#", can also be used without combining with worksheet index. For example, Set File Name(s) as Wks<pound>2 then the file name would be Wks#2.
3. Besides choosing from one of the three options above, you can type the desired file name manually.
Path path

Input

string

Specify the file path to save the exported PDF file(s).

Overwrite Existing overwrite

Input

int

3

Specify the way to export PDF file when there is an existing file with the same name under the same path. Option list:

• rename:Auto Rename
Auto rename the exported PDF file with enumeration.
• replace:Replace
Replace the existing PDF file.
• skip:Skip
Skip the exporting of the PDF file and keep the existing one.
Pop up a message box to ask whether to overwrite the existing PDF file.
Image Settings tr2

Input

TreeNode

<unassigned>

Specify the properties of the exported PDF file.

See more details in the Details for Dialog Settings of Description section.

Print Settings tr3

Input

TreeNode

<unassigned>

Specify the print settings of the exported PDF file.

See more details in the Details for Dialog Settings of Description section.

## Description

This X-Function is used to export worksheet(s), including those contain images or embedded/linked graphs, to a multi-page PDF File.

 Note: Report sheets cannot be exported to PDF files. If a worksheet is too large, it will be exported to multiple pages in a single PDF file.

### Details for Dialog Settings

#### Image Settings (tr2)

Treenode Label Type Default Description
PDF PDF Options Input TreeNode <unassigned> This treenode is used to specify the export settings of the PDF file. See more details in the PDF Options Subtree table below.
MultiPage Multiple Pages Input TreeNode <unassigned> This treenode is used to specify the cover page and the pagination which is used when the exported PDF file includes more than one page. See more details in the Multiple Pages Subtree table below.

#### PDF Options Subtree

Treenode Label Type Default Description
PDF Basic Object Input TreeNode <unassigned> Please refer to Basic Object of PDF.
Compressiontree Data Compression Input TreeNode <unassigned> Please refer to Compression of PDF.
Fonts Fonts Input TreeNode <unassigned> Please refer to Fonts of PDF.

#### Multiple Pages Subtree

Specify whether or not to add a cover page and page numbers on the exported PDF file.

Treenode Label Type Default Description
CoverPage Cover Page Input TreeNode <unassigned> This is only available when the check box to the right of Cover Page is checked. It specifies whether or not to add a cover page on the exported PDF file. By default, there is no cover page. Tree nodes in the this branch are listed below (In the bold texts below, the word before the colon is the name of the treenode, and after colon is the label of the treenode):
Text: Text
The texts typed in this text field will be displayed on the cover page.
Font: Font
This branch is used to set the font of the cover page texts.
Name: Name
Specify the font face of the texts.
Size: Size
Select or type the desired point size of the texts. Default size is 18.
Bold: Bold
Specify whether the texts should be bold or not. This check box is checked by default.
Italic: Italic
Specify whether the texts should be italic or not. This check box is unchecked by default.
Underline: Underline
Specify whether or not to add underlines to the texts. This check box is unchecked by default.
Pagination Page Numbering Input TreeNode <unassigned> This branch can be expanded only when the check box to the right of Page Numbering is checked. It specifies whether or not to add page numbers on the exported PDF file. By default, there is no page number added. Note that if the exported PDF file includes a cover page, the cover page will be regarded as the first page, but page number will not be displayed on it. Tree nodes in the this branch are listed below (In the bold texts below, the word before the colon is the name of the treenode, and after colon is the label of the treenode):
FontP: Font
This branch is used to set the font of the page numbers.
Name: Name
Specify the font face of the page numbers.
Size: Size
Select or enter the point size of the page numbers. Default size is 18.
Bold: Bold
Specify whether the page numbers should be bold. This check box is checked by default.
Italic: Italic
Specify whether the page numbers should be italic. This check box is unchecked by default.
Underline: Underline
Specify whether or not to add underline to the page numbers. This check box is unchecked by default.
Top: Top
Specify whether or not to add page numbers in the top of the pages in the exported PDF file. This check box is unchecked by default.
Bottom: Bottom
Specify whether or not to add page numbers in the bottom of the pages in the exported PDF file. This check box is unchecked by default.
HorizPos: Horizontal Position
Specify the horizontal position of the page numbers. If both Top and Bottom are unchecked, the horizontal position specified here is not useful because there are no page numbers in the PDF file. Options include:
• 0: Left on even, right on odd pages
The page numbers are shown to the left of even pages and to the right of odd pages.
• 1: Left
The page numbers are shown to the left of all pages.
• 2: Right
The page numbers are shown to the right of all pages.
• 3: Center
The page numbers are shown in the center of all pages. It is selected by default.

#### Print Settings (tr3)

Treenode Label Type Default Description
UseOwn Use Worksheet's Own Settings Input int 1 Specify whether or not to use the worksheet's own settings (horizontal grids, row header settings etc.) to print the exported PDF file. If this is not selected, you can specify the options in the Worksheet Print Options branch.
Check Worksheet Print Options Input TreeNode <unassigned> This is only available when Use Worksheet's Own Settings is unchecked. This treenode can be used to specify whether or not to print some worksheet elements. See more details in the Worksheet Print Options Subtree table below.
Margin Margin Input TreeNode <unassigned> This is only available when the Use Worksheet's Own Settings is unchecked. This treenode can be used to specify the margins. Two units, mm and inch, are available for the margins. See more details in the Worksheet Print Options Subtree table below.

#### Worksheet Print Options Subtree

Treenode Label Type Default Description
Chk_Horz_Grids Horizontal Grids Input int 0 Specify whether or not to print the horizontal grids of the PDF file.
Chk_Vert_Grids Vertical Grids Input int 0 Specify whether or not to print the vertical grids of the PDF file.
Chk_Row_Header Row Header Input int 0 Specify whether or not to print the row header of the PDF file.
Chk_Col_Header Column Header Input int 0 Specify whether or not to print the column header of the PDF file.
Chk_Page_Header Page Header Input int 0 Specify whether or not to print the page header of the PDF file.
Chk_Page_Footer Page Footer Input int 0 Specify whether or not to print the page footer of the PDF file.
Chk_BkColor Background Color Input int 1 Specify whether or not to print the background color of the PDF file.
Chk_Frame Frame Input int 1 Specify whether or not to print the frame of the PDF file.
Chk_EmptyCols Empty Cols Input int 0 Specify whether or not to print the empty columns in the PDF file.
Chk_EmptyRows Empty Rows Input int 0 Specify whether or not to print the empty rows in the PDF file.

#### Margin Subtree

Treenode Label Type Default Description
Left Left Input Double 6.35 Specify the left margin.
Right Right Input Double 6.35 Specify the right margin.
Top Top Input Double 6.35 Specify the top margin.
Bottom Bottom Input Double 6.35 Specify the bottom margin.

## Examples

1. Create a new project with a new book, and then select Data: Import from File: Comma Delimited (CSV)... from the main menu to import the data <Origin Program Directory>\Samples\Import and Export\donations.csv.
2. Activate the worksheet with the imported data and select File: Export: As Multipage PDF File... from the main menu to bring up the expPDFw dialog.
3. In the dialog, change the File Name (s) to donations and the Path to C:\My PDF Files. In the Multiple Pages branch under the Image Settings branch, select the check box after Cover Page, and then expand it. Type Donations in the Text field and change the font size to 72. Keep other options to the default values.
4. Click the OK button. Then a PDF file named donations.pdf is exported to the directory C:\My PDF Files.

## Related X-Functions

Keywords:publishing