Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    Statistic    FMM    Blog  

WordFile.GetXML

Queries xml content of the word file.

Component Version macOS Windows Linux Server iOS SDK
WordFile 6.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "WordFile.GetXML"; WordFile { ; Part } )   More

Parameters

Parameter Description Example Flags
WordFile The reference number of the open word file. $wordFile
Part The name of the part to query.
See WordFile.Parts for a list of parts.
if no part is given, we use the document.
"document" Optional

Result

Returns xml text or error.

Description

Queries xml content of the word file.
Getting the raw xml allows you to make modification yourself like adding paragraphs or a table.

Examples

Query XML of first footer:

MBS( "WordFile.GetXML"; $wordFile; "footer1" )

Query document relations:

MBS( "WordFile.GetXML"; $WordFile; "document.xml.rels")

Query custom properties of a word file:

# open word file
Set Variable [ $wordfile ; Value: MBS( "WordFile.OpenContainer"; WordFile::Input ) ]
If [ MBS("ISError") ]
    Show Custom Dialog [ "Error" ; $wordFile ]
    Exit Script [ Text Result: ]
End If
#
# read xml
Set Variable [ $xml ; Value: MBS( "WordFile.GetXML"; $WordFile; "custom") ]
#
# get property count
Set Variable [ $count ; Value: MBS( "XML.NodeCount"; $xml; "property" ) ]
#
If [ $count > 0 ]
    Set Variable [ $i ; Value: 0 ]
    #
    Loop
        Set Variable [ $name ; Value: MBS( "XML.GetPathValue"; $xml; "Properties.property[" & $i & "]#name"; 1+2 ) ]
        Set Variable [ $value ; Value: MBS( "XML.GetPathValue"; $xml; "Properties.property[" & $i & "].lpwstr"; 1+2 ) ]
        #
        Show Custom Dialog [ "Custom propety" ; $name & ": " & $value ]
        #
        Set Variable [ $i ; Value: $i + 1 ]
        Exit Loop If [ $i >= $count ]
    End Loop
    #
    #
End If
#
# free memory
Set Variable [ $r ; Value: MBS( "WordFile.Release"; $WordFile) ]

See also

Release notes

  • Version 9.5
    • Improved WordFile.GetXML function to work with rels parts in the Word file.

Blog Entries

Created 15th March 2016, last changed 6th December 2020


WordFile.GetMediaFile - WordFile.HasTag

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins

Start Chat