This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP Import document
|
WP Import document ( filePath {; option} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
filePath | String |
![]() |
Path to: a 4D Write document (.4w7 or .4wt) or a 4D Write Pro document (.4wp) or a .docx document (.docx) |
|||||
option | Longint, Object |
![]() |
(longint) Import option for HTML expressions (object) Import options for .docx document |
|||||
Function result | Object |
![]() |
4D Write Pro object | |||||
The WP Import document command converts an existing 4D Write Pro / 4D Write document (.4wp, .4w7 or .4wt) or MS Word document (.docx) to a new 4D Write Pro object.
In the filePath parameter, pass the path of a document stored on disk. The following types of documents are supported:
You must pass a complete path, unless the document is located at the same level as the structure file, in which case you can just pass its name.
Note: If you want to import a document stored in a 4D BLOB field, you can also consider using the WP New command.
An error is returned if the filePath parameter is invalid, or if the file is missing or the file format is not supported.
The optional option parameter allows defining import options for:
##htmlBegin##<span>Imported title<b>bold</b></span>##htmlEnd##
Attribute | Type | Description |
anchoredTextAreas | Text | For MS Word (.docx) documents only. Specifies how Word anchored text areas are handled. Available values:
Note: The layout and the number of pages in the document may change. See also How to import .docx format |
anchoredImages | Text | For MS Word (.docx) documents only. Specifies how anchored images are handled. Available values:
|
sections | Text | For MS Word (.docx) documents only. Specifies how section are handled. Available values:
Note: Section breaks of any type but continuous are converted to section breaks with page break. Continuous section breaks are imported as continuous section breaks. |
fields | Text | For MS Word (.docx) documents only. Specifies how .docx fields that can't be converted to 4D Write Pro formulas are handled. Available values:
Note: If a .docx field corresponds to a 4D Write Pro variable, the field is imported as a formula and this option is ignored. |
borderRules | Text | For MS Word (.docx) documents only. Specifies how paragraph borders are handled. Available values:
|
preferredFontScriptType | Text | For MS Word (.docx) documents only. Specifies the preferred typeface to use when different typefaces are defined for a single font property in OOXML. Available values:
|
htmlExpressions | Text | For 4D Write (.4w7) documents only. Specifies how HTML expressions are handled. Available values:
|
importDisplayMode | Text | For 4D Write (.4w7) documents only. Specifies how image display is handled. Available values:
|
Compatibility Notes
C_OBJECT(WPDoc)
WPDoc:=WP Import document("C:\\documents\\4DWriteDocs\\Letter.4w7")
You want to import a .docx document and would like that paragraph borders are collapsed as they are in MS Word:
$options:=New object
$options.borderRules:="collapse" //collapse paragraph borders while converting
wpDoc:=WP Import document(«mydoc.docx»;$options)
You want to import original .docx fields as text (for fields not converted to 4D formulas):
$options:=New object
$options.fields:="label" //for unconverted fields, import field references as text between {{ and }}
wpDoc:=WP Import document(«mydoc.docx»;$options)
You want to import a .docx document whose text is mostly in Japanese:
$options:=New object
$options.preferredFontScriptType:="eastAsia" //force conversion to prefer eastAsia font scripts
wpDoc:=WP Import document(«mydoc.docx»;$options)
Product: 4D
Theme: 4D Write Pro Language
Number:
1318
Created: 4D v14 R5
Modified: 4D v15 R2
Modified: 4D v18 R6
Modified: 4D v19
Modified: 4D v19 R2
Modified: 4D v19 R3
4D Write Pro Reference ( 4D v20 R7)