|
DocInsert (Function) In french: DocInsère Inserts an object into a Word Processing document or replaces the content of the current fragment. The objects that can be used are: - an element,
- a document,
- a paragraph,
- a text,
- an image,
- a fragment,
Versions 25 and latera table of contents. New in version 25a table of contents. a table of contents.
Caution: This documentation presents the last features of the Word Processing control. Make sure that all the necessary modules are updated.
// Inserts an image cursor location // Select the image file sFile is string sFile = fImageSelect(fCurrentDir(), "", ... "Insert an image","JPEG (*.JPG)" + TAB + "*.jpg" + CR + ... "PNG (*.PNG)" + TAB + "*.png" + CR + "All files (*.*)" + TAB + "*.*") IF sFile = "" THEN RETURN END // The image file is transferred into an Image variable img is Image img = sFile // Declare an Image element (that will be inserted into the document) elt is docElement elt.Type = typeDocElementImage elt.Image.BufferImage = img elt.Image.Wrapping = docWrappingAlignedOnText // Calculate the width and height of the image found in the element // The image size is expressed in pixels in the Image variable. // This size is converted into mm in the element (unit used in a document) elt.Image.Width = img.Width * 25.4 / 96.0 elt.Image.Height = img.Height * 25.4 / 96.0 // Image position elt.Image.X = 0 elt.Image.Y = 0 DocInsert(WP_MyDocument, WP_MyDocument..Cursor, elt)
Versions 23 and later
doc is Document <- WP_MyDocument.Value // Find the bookmark position fragmentBookmark is docFragment = doc.Bookmark["Bookmark 1"] IF fragmentBookmark <> Null THEN // Insert text at the end of bookmark let nInsertionPosition = fragmentBookmark.EndPosition // Actual insertion DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position") ELSE Erreur("'Bookmark 1' bookmark not found in the document") END
New in version 23
doc is Document <- WP_MyDocument.Value // Find the bookmark position fragmentBookmark is docFragment = doc.Bookmark["Bookmark 1"] IF fragmentBookmark <> Null THEN // Insert text at the end of bookmark let nInsertionPosition = fragmentBookmark.EndPosition // Actual insertion DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position") ELSE Erreur("'Bookmark 1' bookmark not found in the document") END
doc is Document <- WP_MyDocument.Value // Find the bookmark position fragmentBookmark is docFragment = doc.Bookmark["Bookmark 1"] IF fragmentBookmark <> Null THEN // Insert text at the end of bookmark let nInsertionPosition = fragmentBookmark.EndPosition // Actual insertion DocInsert(WP_MyDocument, nInsertionPosition, "Text to insert at bookmark position") ELSE Erreur("'Bookmark 1' bookmark not found in the document") END
Syntax
Inserting an object at a position Hide the details
<Result> = DocInsert(<Document> , <Position> , <Element>)
<Result>: docFragment variable Versions 24 and laterdocFragment variable with the inserted fragment. New in version 24docFragment variable with the inserted fragment. docFragment variable with the inserted fragment.
<Document>: Document variable or character string (with or without quotes) Document to use. This document corresponds to: the name of a Word Processing control. - an Document variable.
<Position>: Integer Position where the element will be inserted. This position is expressed in number of characters. <Element>: Type corresponding to the element to insert Element to insert: - Element: Name of the docElement variable that corresponds to the element to insert.
- Document: Name of the Document variable that corresponds to the document to insert.
- Paragraph: Name of the docParagraph variable that corresponds to the paragraph to insert.
- Text in character string format: Text to Insert.
Versions 24 and laterYou can use the following constants in the insertion text to manage the different possible breaks: | | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
New in version 24You can use the following constants in the insertion text to manage the different possible breaks: | | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
You can use the following constants in the insertion text to manage the different possible breaks:
| | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
- Image: Name of the Image variable that will be inserted at the specified position.
- Fragment: Name of the docFragment variable that will be inserted at the specified position.
Replacing a fragment by an object (text, document, fragment, paragraph, ...) Hide the details
<Result> = DocInsert(<Fragment> , <Object to use>)
<Result>: docFragment variable Versions 24 and laterdocFragment variable with the inserted fragment. New in version 24docFragment variable with the inserted fragment. docFragment variable with the inserted fragment.
<Fragment>: docFragment variable Name of the docFragment variable to use. The content of this fragment will be replaced by the specified object. <Object to use>: Variable corresponding to the object type Objet replacing the fragment content. This object can correspond to: - a character string.
Versions 24 and laterYou can use the following constants in the text to manage the different possible breaks: | | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
New in version 24You can use the following constants in the text to manage the different possible breaks: | | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
You can use the following constants in the text to manage the different possible breaks:
| | docColumnBreak | Adds a column break in a multicolumn section. If the section is not multicolumn, a page break is added. | docLineBreak | Adds a line break. | docPageBreak | Adds a page break. | docParagraphBreak | Adds a paragraph break to. |
Business / UI classification : UI Code
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |