AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones Procesador de texto
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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,
  • a table of contents.
Ejemplo
// 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)
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
	Error("'Bookmark 1' bookmark not found in the document")
END
Sintaxis

Inserting an object at a position Ocultar los detalles

<Result> = DocInsert(<Document> , <Position> , <Element>)
<Result>: docFragment variable
docFragment variable with the inserted fragment.
<Document>: Document or String variable
Document to use. This document corresponds to:
<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 type variable corresponding to the element to be inserted.
  • Document: Name of the Document variable corresponding to the document to be inserted.
    Caution: The following elements of the inserted document are not retained:
    • The default layout of the inserted document (e.g. margins).
    • The parameters of the main section of the inserted document (e.g. headers and footers).
  • Paragraph: Name of the docParagraph variable corresponding to the paragraph to be inserted.
  • String text: Text to be inserted.
    You can use the following constants in the insertion text to manage the different possible breaks:
    docColumnBreakAdds a column break in a multicolumn section. If the section is not multicolumn, a page break is added.
    docLineBreakAdds a line break.
    docPageBreakAdds a page break.
    docParagraphBreakAdds a paragraph break to.
  • Image: Name of the Image variable to be inserted at the specified position.
  • Fragment: Name of the docFragment variable to be inserted at the specified position.

Replace a fragment with an object (text, document, fragment, paragraph, etc.) Ocultar los detalles

<Result> = DocInsert(<Fragment> , <Object to use>)
<Result>: docFragment variable
docFragment variable with the inserted fragment.
<Fragment>: docFragment variable
Name of the docFragment variable to be used. The content of this fragment will be replaced with the specified object.
<Object to use>: Variable corresponding to the object type
Object replacing the fragment content. This object can correspond to:
  • a character string.
    You can use the following constants in the text to manage the different possible breaks:
    docColumnBreakAdds a column break in a multicolumn section. If the section is not multicolumn, a page break is added.
    docLineBreakAdds a line break.
    docPageBreakAdds a page break.
    docParagraphBreakAdds a paragraph break to.
Clasificación Lógica de negocio / UI: Código UI
Componente: wd300mdl.dll
Versión mínima requerida
  • Versión 22
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local