WP EXPORT VARIABLE
WP EXPORT VARIABLE ( wpDoc ; destination ; format {; option} )
引数 | 型 | 説明 | |
---|---|---|---|
wpDoc | Object | → | 4D Write Pro 変数 |
destination | Text, BLOB | → | Variable to receive exported contents |
format | Integer | → | Variable output format |
option | Object, Integer | → | 書き出しのオプション |
説明
The WP EXPORT VARIABLE command exports the wpDoc 4D Write Pro object to the 4D destination variable in the specified format.
wpDoc 引数には、書き出したい4D Write Pro オブジェクトを渡します。
In destination, pass the variable that you want to fill with the exported 4D Write Pro object. The type of this variable depends on the export format specified in the format parameter:
- 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. 以下のフォーマットがサポートされています:
定数 | 型 | 値 | 説明 |
---|---|---|---|
wk 4wp | Integer | 4 | 4D Write Pro ドキュメントはネイティブなアーカイブフォーマット(圧縮されたHTML で画像は別個のフォルダに保存)で保存されます。 4D 特有のタグは含まれ、4D 式は計算されません。 このフォーマットは特にロスなく4D Write Pro ドキュメントをディスク上に保存するのに適しています。 4D 特有のタグは含まれ、4D 式は計算されません。 4D Write Pro ドキュメントはネイティブなアーカイブフォーマット(圧縮されたHTML で画像は別個のフォルダに保存)で保存されます。 4D 特有のタグは含まれ、4D 式は計算されません。 このフォーマットは特にロスなく4D Write Pro ドキュメントをディスク上に保存するのに適しています。 4D 特有のタグは含まれ、4D 式は計算されません。 このフォーマットは特にロスなく4D Write Pro ドキュメントをディスク上に保存するのに適しています。 |
wk docx | Integer | 7 | .docx 拡張子を意味します。 4D Write Pro ドキュメントはMicrosoft Word フォーマットで保存されます。 Microsoft Word 2010 以降に正式に対応しています。 書き出しに対応しているドキュメントの部分は以下の通りです:: 本文 / ヘッダー / フッター / セクション / ページ / 印刷設定 (余白、背景色 / 背景画像、境界線、パディング、用紙サイズ / 用紙の向き) 画像 - インライン、アンカー、背景画像パターン(wk background image で定義されているもの) 互換性のある変数と式(ページ番号、ページ数、日付、時間、メタデータ)。 互換性のない変数と式は評価されて、書き出しの前に値が固定化されます。 リンク - ブックマーク URL 一部の4D Write Pro 設定はMicrosoft Word では利用できないか、振る舞いが異なる可能性があることに注意してください。 |
wk mime html | Integer | 1 | 4D Write Proドキュメントは標準のMIME HTMLとして保存され、htmlドキュメントと画像はMIMEパーツとして埋め込まれます(base64でエンコードされます)。 式は計算され4D特有のタグやメソッドのリンクは除去されます。 埋め込みビューにアンカーされたテキストボックスのみが(divとして)書き出されます。 このフォーマットは コマンドを使用してHTML Eメールを送信するのに特に適しています。 式は計算され4D特有のタグやメソッドのリンクは除去されます。 埋め込みビューにアンカーされたテキストボックスのみが(divとして)書き出されます。 このフォーマットは コマンドを使用してHTML Eメールを送信するのに特に適しています。 |
wk pdf | Integer | 5 | .pdf 拡張子。 .pdf 拡張子。 4D Write Pro ドキュメントはページビューモードに基づいてPDF フォーマットで保存されています。 PDF ドキュメントには以下のメタ情報が書き出されています: タイトル 作者 タイトル コンテンツ作成者 注意: 式は、ドキュメントが書き出されるときに自動的に値が計算されて固定化されます。メソッドへのリンクはサポートされていません。 PDF ドキュメントには以下のメタ情報が書き出されています: タイトル 作者 タイトル コンテンツ作成者 注意: 式は、ドキュメントが書き出されるときに自動的に値が計算されて固定化されます。メソッドへのリンクはサポートされていません。 |
wk svg | Integer | 8 | 4D Write Pro ドキュメントのページはページビューモードに基づいてSVG フォマットで保存されます。 注意: SVG へと書き出す際は、一度に1ページしか書き出すことができません。 書き出すページを指定するにはwk page index を使用して下さい。 注意: SVG へと書き出す際は、一度に1ページしか書き出すことができません。 書き出すページを指定するにはwk page index を使用して下さい。 注意: SVG へと書き出す際は、一度に1ページしか書き出すことができません。 書き出すページを指定するにはwk page index を使用して下さい。 |
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. |
注:
- "4D 特有のタグ"とは、4Dネームスペースと4D CSSスタイルを含めた4D XHTMLのことです。
- 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.
option 引数
option 引数には、書き出されるドキュメントのプロパティを定義する値を格納しているオブジェクト を渡します。 次のプロパティを利用することができます: 次のプロパティを利用することができます: 次のプロパティを利用することができます:
定数 | 値 | 説明 |
---|---|---|
wk CID host domain name | cidHostDomain | CID ホストドメイン名: 生成されるCID URL に追加されるホストドメイン。'@' が区切り文字として含まれます。 wk mime html フォーマットが使用されている際にのみ使用可能です。 Available only when the wk mime html format is used. |
wk embedded pictures | embeddedPictures | SVG 書き出し専用。 WP EXPORT DOCUMENT を呼び出した時、ピクチャーが書き出された.svg ファイル内に埋め込まれるかどうかを設定します。 Available values: |
wk factur x | facturX | PDF 書き出しのみ。 Value: object configuring a "Factur-X (ZUGFeRD)" PDF export (see wk factur x object). |
wk files | files | PDF 書き出しのみ。 Value: collection of objects, each of them describing a file to be embedded in the final document (see wk files collection). This feature is only supported in PDF/A-3 documents: when the wk files attribute is used, the "PDF/A-3" version is automatically set (the wk pdfa version attribute is ignored). Factur-X PDF 書き出し(下記参照)の場合、コレクションの最初のオブジェクトにはFactur-X XML ファイルが格納されている必要があります。 |
wk google fonts tag | googleFontsTag | SVG書き出し専用。 SVG書き出し専用。 SVG書き出し専用。 書き出されたSVG 内でのGoogle フォントの読み込みルールを設定します。 取り得る値: false (デフォルト): Google フォントの読み込みルールは何も追加されません。 true: 書き出されたファイルに@import ルールを追加します。 Windows またはmacOS において利用できないフォントを使用したい場合に有用です。 注意: このプロパティはデフォルトではFalse に設定されています。なぜなら読み込まれたGoogle フォントはネイティブのフォントを上書きしますが、一般的にはネイティブのフォントはブラウザ上で綺麗にレンダリングされるからです。 取り得る値: false (デフォルト): Google フォントの読み込みルールは何も追加されません。 true: 書き出されたファイルに@import ルールを追加します。 Windows またはmacOS において利用できないフォントを使用したい場合に有用です。 注意: このプロパティはデフォルトではFalse に設定されています。なぜなら読み込まれたGoogle フォントはネイティブのフォントを上書きしますが、一般的にはネイティブのフォントはブラウザ上で綺麗にレンダリングされるからです。 Possible values: |
wk HTML pretty print | htmlPrettyPrint | HTML コードは読みやすいようにフォーマットされます。 |
wk max picture DPI | maxPictureDPI | 画像を適切な解像度にリサンプリング(縮小)するのに使用されます。 Windows でのSVG 画像に対しては。ラスタライズに使用されます。 デフォルト値: 300 (for wk optimized for = wk print 時) 192 (for wk optimized for = wk screen 時) 取り得る最大値: 1440 |
wk optimized for | optimizedFor | 書き出されたドキュメントを、その目的に応じてどのように最適化するかを定義します。 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. Vectorial pictures are converted to PNG using the DPI defined by wk max picture DPI or 300 (Windows only). If a picture contains more than one format, the best format for printing is used (e.g., .tiff instead or .jpg)wk screen (default value for wk web page complete and 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. Vectorial pictures are converted to PNG using the DPI defined by wk max picture DPI or 192 (Windows only). If a picture contains more than one format, the format for screen rendering is used.wk docx format are always optimized for wk print (wk optimized for option is ignored). |
wk page index | pageIndex | SVG書き出し専用。 SVG書き出し専用。 SVG フォーマットへと書き出すページのインデックス(デフォルトは1)。 ページのインデックスは1から始まり、これはドキュメントの最初のページを指します。 注意: ページインデックスはページナンバリングとは異なるものです。 ページのインデックスは1から始まり、これはドキュメントの最初のページを指します。 注意: ページインデックスはページナンバリングとは異なるものです。 |
wk pdfa version | pdfaVersion | PDF/A バージョンに適合したPDF を書き出します。 PDF/A のプロパティおよびバージョンの詳細については、Wikipedia のPDF/A のページ を参照してください。 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". Windows 上では、出力されたPDF ファイルは常に指定されたバージョンと同じになります。 |
wk recompute formulas | recomputeFormulas | 書き出し時にフォーミュラを再計算するかどうかを定義します。 Possible values: |
wk visible background and anchored elements | visibleBackground | 背景画像/背景色、アンカーされた画像またはテキストボックス(ディスプレイ用では、ページビューモードまたは埋め込みビューモードでのみ表示されるエフェクト)を表示または書き出しをします。 取り得る値: True/False 取り得る値: True/False 取り得る値: True/False |
wk visible empty images | visibleEmptyImages | 読み込めない、あるいは計算できない画像(空の画像またはサポートされていないフォーマットの画像)に対してデフォルトの黒い四角形を表示または書き出しします。 取り得る値: True/False. 取り得る値: True/False. デフォルト値: True 値がFalse の場合、たとえ画像に境界線、幅、高さ、背景などが設定されてあっても空の画像要素は全く表示されないという点に注意して下さい。これはインライン画像のページレイアウトに影響する可能性があります。 |
wk visible footers | visibleFooters | フッターを表示または書き出しします(表示用においてはページビューモードでのみ表示されるエフェクトです)。 取り得る値: True/False 取り得る値: True/False |
wk visible headers | visibleHeaders | ヘッダーを表示または書き出しします(表示用においてはページビューモードでのみ表示されるエフェクトです)。 取り得る値: True/False 取り得る値: True/False 取り得る値: True/False |
wk visible references | visibleReferences | ドキュメントに挿入されている4D 式を参照として表示または書き出しします。 取り得る値: 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". |
以下の表はformat 引数の各フォーマットごとに利用可能なoption 引数のオプションをあらわしています:
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 | - | 常に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 | - | 常にtrue | - | |||
wk visible empty images | - | - | ||||
wk visible footers | - | 常にtrue | 常にfalse | - | ||
wk visible headers | - | 常にtrue | 常にfalse | - | ||
wk visible references | - | - | - | - | ||
wk whitespace | - | - | - | - | - |
互換性に関する注意: option 引数に倍長整数 型の値を渡すことは互換性の理由からサポートされていますが、オブジェクト型 型の引数を渡すことが推奨されています。
例題 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)
例題 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
例題 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)
参照
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