WP EXPORT VARIABLE
WP EXPORT VARIABLE ( wpDoc ; destination ; format {; option} )
Parâmetro | Tipo | Descrição | |
---|---|---|---|
wpDoc | Object | → | Variável 4D Write Pro |
destination | Text, BLOB | → | Variable to receive exported contents |
format | Integer | → | Formato de saída variável |
option | Object, Integer | → | Opções de exportação |
Descrição
The WP EXPORT VARIABLE command exports the wpDoc 4D Write Pro object to the 4D destination variable in the specified format.
Em wpDoc, passe o objeto 4D Write Pro que você deseja exportar.
In destination, pass the variable that you want to fill with the exported 4D Write Pro object. O tipo dessa variável depende do formato de exportação especificado no parâmetro format:
- If you pass the native .4wp format or the .docx format, the variable will be of the Blob type,
- If you pass an HTML or SVG format, the variable will be of the Text type.
In the format parameter, pass a constant from the 4D Write Pro Constants theme to set the export format you want to use. Each format is related to a specific use. São suportados os seguintes formatos:
Parâmetros | Tipo | Valor | Comentário |
---|---|---|---|
wk 4wp | Integer | 4 | 4D Write Pro document is saved in a native archive format (zipped HTML and images saved in a separate folder). 4D specific tags are included and 4D expressions are not computed. This format is particularly suitable for saving and archiving 4D Write Pro documents on disk without any loss. |
wk docx | Integer | 7 | Extensão .docx. 4D Write Pro document is saved in Microsoft Word format. Certified support for Microsoft Word 2010 and newer. The document parts exported are: Body / headers / footers / sectionsPage / print settings (margins, background color / image, borders, padding, paper size / orientation)Images - inline, anchored, and background image pattern (defined with wk background image)Compatible variables and expressions (page number, number of pages, date, time, metadata). Non-compatible variables and expressions will be evaluated and frozen before export.Links - BookmarksURLsNote that some 4D Write Pro settings may not be available or may behave differently in Microsoft Word. |
wk mime html | Integer | 1 | 4D Write Pro document is saved as standard MIME HTML with HTML documents and images embedded as MIME parts (encoded in base64). Expressions are computed and 4D specific tags and method links are removed. Only text boxes anchored to embedded view are exported (as divs). This format is particularly suitable for sending HTML emails with the command. |
wk pdf | Integer | 5 | Extensão .pdf. 4D Write Pro document is saved in PDF format, based on Page view mode. The following metadata is exported in a PDF document: Title Author Subject Content creator Notes: Expressions are automatically frozen when document is exported Links to methods are NOT exported |
wk svg | Integer | 8 | 4D Write Pro document page is saved in SVG format, based on Page view mode. Nota: ao exportar para SVG, você só pode exportar uma página de cada vez. Use wk page index para especificar qual página exportar. |
wk web page html 4D | Integer | 3 | 4D Write Pro document is saved as HTML and includes 4D specific tags; each expression is inserted as a non-breaking space. Since this format is lossless, it is appropriate for storing purposes in a text field. |
Notas:
- "4D specific tags" means 4D XHTML with a 4D namespace and 4D CSS styles.
- For more information about the 4D Write Pro document format, refer to .4wp document format.
- To view a list of known differences or incompatibility when using the .docx format, see Importing and Exporting in .docx format.
- When exporting to SVG format with this command, images are embedded in base64 format.
- For more information on exporting to SVG format, see Exporting to SVG format.
Parâmetro option
Pass an object in option containing the values to define the properties of the exported document. As seguintes propriedades estão disponíveis:
Parâmetros | Valor | Comentário |
---|---|---|
wk CID host domain name | cidHostDomain | CID host domain name: host domain that will be added to generated CID URLs including an '@' as separator. Disponível somente quando o formato wk mime html é usado. |
wk embedded pictures | embeddedPictures | Somente para exportação SVG. Sets whether pictures are embedded in the exported .svg file when you call WP EXPORT DOCUMENT. Available values: |
wk factur x | facturX | Somente para exportação em PDF. Valor: objeto que configura uma exportação de PDF "Factur-X (ZUGFeRD)" (consulte wk factur x object). |
wk files | files | Somente para exportação em PDF. Valor: coleção de objetos, cada um deles descrevendo um arquivo a ser incorporado no documento final (consulte wk files collection). Este recurso só é suportado em documentos PDF/A-3: quando o atributo wk files é usado, a versão "PDF/A-3" é definida automaticamente (o atributo wk pdfa version é ignorado). In case of a Factur-X PDF export (see below), the first object of the collection must contain the Factur-X xml file. |
wk google fonts tag | googleFontsTag | Somente para exportação SVG. Sets the import rule for google fonts in the exported SVG. Possible values: |
wk HTML pretty print | htmlPrettyPrint | HTML code is formatted to be easier to read. |
wk max picture DPI | maxPictureDPI | Used for resampling (reducing) images to preferred resolution. For SVG images in Windows, used for rasterization. Default values: 300 (for wk optimized for = wk print) 192 (for wk optimized for = wk screen) Maximum possible value: 1440 |
wk optimized for | optimizedFor | Defines how an exported document is optimized based on its intended medium. Possible values:wk print (default value for wk pdf and wk svg ) Bitmap pictures may be downscaled using the DPI defined by wk max picture DPI or 300 (default value) and may be converted to PNG if codec is not supported for the export type. Imagens vetoriais são convertidas para PNG usando o DPI definido por wk max image DPI ou 300 (apenas Windows). Se uma imagem contiver mais de um formato, será usado o melhor formato para impressão (por exemplo, .tiff em vez de .jpg)wk screen (valor padrão para wk web page complete e wk mime html ). Bitmap pictures may be downscaled using the DPI defined by wk max picture DPI or 192 (default value) and may be converted to JPEG (opaque images) or PNG (transparent images) if codec is not supported for the export type. Imagens vetoriais são convertidas para PNG usando o DPI definido por wk max image DPI ou 192 (apenas Windows). Se uma imagem contiver mais de um formato, será utilizado o formato para a renderização de tela. Uwk docx são sempre otimizados para impressão wk (wk otimizado para opção é ignorado). |
wk page index | pageIndex | Somente para exportação SVG. Index of the page to export to svg format (default is 1). Page index starts at 1 for the first page of the document. Nota: o índice de páginas é independente da numeração de páginas. |
wk pdfa version | pdfaVersion | Exports PDF with conformance to a PDF/A version. For more information on PDF/A properties and versions, please refer to the PDF/A page on Wikipedia. Possible values: wk pdfa2 : Exports to version "PDF/A-2"wk pdfa3 : Exports to version "PDF/A-3"wk pdfa2 may export to PDF/A-2 or PDF/A-3 or higher, depending on platform implementation. Also, wk pdfa3 means "exports to at least PDF/A-3". On Windows, the output PDF file will always be equal to the desired conformance. |
wk recompute formulas | recomputeFormulas | Defines if formulas must be recomputed when exported. Valores possíveis: |
wk visible background and anchored elements | visibleBackground | Displays or exports background images/color, anchored images and text boxes (for display, visible effect in Page or Embedded view mode only). Valores possíveis: True/False |
wk visible empty images | visibleEmptyImages | Displays or exports a default black rectangle for images that cannot be loaded or computed (empty images or images in an unsupported format). Possible values: True/False. Default value: True If value is False, missing image elements will not be displayed at all even if they have borders, width, height, or background; this may impact the page layout for inline images. |
wk visible footers | visibleFooters | Displays or exports the footers (for display, visible effect in Page view mode only). Valores possíveis: True/False |
wk visible headers | visibleHeaders | Displays or exports the headers (for display, visible effect in Page view mode only). Valores possíveis: True/False |
wk visible references | visibleReferences | Displays or exports all 4D expressions inserted in the document as references. Valores possíveis: True/False |
wk whitespace | whitespace | Sets the "white-space" css value for wk mime html export format. The white-space css style is applied to paragraphs. Possible values: "normal", "nowrap", "pre", "pre-wrap" (default), "pre-line", "break-spaces". |
A tabela a seguir indica a option disponível por format de exportação:
wk 4wp | wk docx | wk mime html | wk pdf | wk web page html 4d | wk svg | |
---|---|---|---|---|---|---|
wk CID host domain name | - | - | - | - | - | |
wk embedded pictures | - | - | - | - | - | |
wk factur x | - | - | - | - | - | |
wk files | - | - | - | - | - | |
wk google fonts tag | - | - | - | - | - | |
wk HTML pretty print | - | |||||
wk max picture DPI | - | sempre 300 | - | |||
wk optimized for | - | always wk print | always wk print | - | ||
wk page index | - | - | - | - | - | |
wk pdfa version | - | - | - | - | - | |
wk recompute formulas | - | - | ||||
wk visible background and anchored elements | - | sempre true | - | |||
wk visible empty images | - | - | ||||
wk visible footers | - | sempre true | sempre false | - | ||
wk visible headers | - | sempre true | sempre false | - | ||
wk visible references | - | - | - | - | ||
wk whitespace | - | - | - | - | - |
Compatibility Note: Passing a longint value in option is supported for compatibility reasons, but it is recommended to use an object parameter.
Exemplo 1
You want to export the contents of the myArea 4D Write Pro object in MIME format and add "gmail.com" as the host domain:
var $option;$export : Object
$option[wk CID host domain name]:="gmail.com"
WP EXPORT VARIABLE(myArea;$export;wk mime html;$option)
Exemplo 2
You want to send an email containing styled text, 4D references and images. You can use a 4D Write Pro area exported in MIME format and sent using SMTP:
// create the transporter
$server:=New object
$server.host:="smtp.gmail.com"
$server.port:=465
$server.user:="4D@gmail.com"
$server.password:="XXXX"
$transporter:=SMTP New transporter($server)
WP EXPORT VARIABLE(WParea;$mime;wk mime html)
$mailTmp:=MAIL Convert from MIME($mime)
// add pictures (if any)
If($mailTmp.attachments#Null)
$email.attachments:=$mailTmp.attachments
End if
$email.bodyStructure:=$mailTmp.bodyStructure
$email.bodyValues:=$mailTmp.bodyValues
$status:=$transporter.send($email)
If(Not($status.success))
ALERT("An error occurred: "+$status.statusText)
End if
Exemplo 3
To export the first page of a 4D Write Pro as SVG in a Text variable and hide the headers:
var $options : Object
var $destination : Text
$options:=New object
$options[wk optimized for]:=wk screen
$options[wk visible headers]:=False
WP EXPORT VARIABLE(WPArea;$destination;wk svg;$options)
Veja também
4D QPDF (Component) - PDF Get attachments
Blog post - 4D Write Pro: Electronic invoice generation
Blog post - 4D Write Pro: Export to PDF with enclosures
Exporting to HTML and MIME HTML formats
Importing and Exporting in .docx format
WP EXPORT DOCUMENT