AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones Procesador de texto / Tipos de variables
  • Importing the styles of document
Document (Example)
Importing the styles of document
This example is used to list the styles of a document to add the requested style into another document.
// List the styles of a document
MyDocControl is Control
// Retrieve an associated document
MyDoc is Document = MyDocControl
// List all the styles used by the document
FOR EACH ADocStyle OF MyDoc.Style
Trace(ADocStyle.StyleID)
END
 
// Add the "Title1" style into a document and apply it to the selection
// The definition of "Title1" style comes from another document
MyDocControl is Control = {"MyWPControl", indControl}
// Retrieve an associated document
MyDoc is Document = MyDocControl
// If the "Title1" style does not exist,
// add it from a document containing preset styles
IF MyDoc.Style["Title1"] = Null THEN
// Opens a document containing the styles
MyDocContainingTheStyles is Document = "c:\MyDocWithMyStyles.docx"
// Retrieves the Title 1 style
StyleTitle1 is docStyle <- MyDocContainingTheStyles.Style["Title1"]
IF StyleTitle1 <> Null THEN
// Adds the style into the document
Add(MyDoc.Style, StyleTitle1)
END
END
// Apply the style to the selection
StyleTitle1ForSelection is docStyle <- MyDoc.Style["Title1"]
IF StyleTitle1ForSelection <> Null THEN
// Create the fragment (from the selection)
f is docFragment(MyDocControl.Value, MyDocControl.Cursor, ...
MyDocControl.SelectionLength)
// Applies the Title1 style to the selection
f.StyleID = StyleTitle1ForSelection.Identifier
END
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/05/2022

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