Help / WLanguage / WLanguage functions / Standard functions / XML file management functions
  • Overview
  • How to?
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Modifying an SVG image (XML functions)
SVG (Scalable Vector Graphics) is a vector image format: this means that the image is drawn on demand and is not "fixed"..
The advantage of these images is that they never pixelate.
SVG is an XML-based format: in WLanguage, it is very easy to modify the properties and attributes of these images.
The advantage of modifying an SVG image in the code is that the same source image can be used in several themes/colors.
How to?
To modify an SVG image in the code:
  1. Load an SVG image:
    To open and edit an SVG image in the code, simply use the xmlDocument type:
    MySVG is xmlDocument
    // Opens the original document
    MySVG = XMLOpen(...
     "C:\[..]\Badge-SVG.svg", fromFile)
  2. Modify the image:
    To modify the image, simply access the properties (attributes) or values to be modified.
    // Changes the color
    // - of the borders
    MySVG.svg.path..Attribute["fill"] = ...
    // - text
    MonSVG.svg.text..Attribute["fill"] = ...
    // Changes the text
    MonSVG.svg.text..Text = "Great!"
  3. Save the modified image:
    The string that corresponds to the modified XML document must be rebuilt. The SVG content can be saved to a file or displayed directly in an Image control.
    // Rebuilds the SVG image
    // to display it in the Image control
    IMG_Preview = XMLBuildString(MySVG)
Minimum version required
  • Version 20
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help