Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

WordFileMBS.AppendTableRow(tag as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 17.1 Yes Yes Yes Yes No
Function: Duplicates a table row containing a placeholder.
Notes:
If you have tables in your template word file and you like to duplicate it, this function can do that and add the new row on the end of the table.

Returns Values
0success
1Tag not found.
2Tag found, but not in a table.
3Missing main document part.

Feedback, Comments & Corrections

WordFileMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 15.4 Yes Yes Yes No No
Function: The private constructor.

Feedback, Comments & Corrections

WordFileMBS.DuplicateTableRow(tag as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 17.1 Yes Yes Yes Yes No
Function: Duplicates a table row containing a placeholder.
Notes:
If you have tables in your template word file and you like to duplicate it, this function can do that and add the new row on just after the row to copy.

Returns Values
0success
1Tag not found.
2Tag found, but not in a table.
3Missing main document part.

Feedback, Comments & Corrections

WordFileMBS.HasTag(tag as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 15.4 Yes Yes Yes Yes No
Function: Checks if a tag exists.
Notes:
The place holder in the document must start with « and end with » characters. The place holder you pass here, should not have those quotes.
Returns true on success or false on failure.

Feedback, Comments & Corrections

WordFileMBS.MediaFile(name as string) as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Wordfile MBS XL Plugin 16.3 Yes Yes Yes No No
Function: Queries or replaces the content of a media file.
Notes:
You can use this to extract images from word file.
Or to replace a placeholder image with the real image.
For replacement please make sure file type and dimensions match.
Raises KeyNotFoundException if media file with given name is not found.
(Read and Write computed property)

Feedback, Comments & Corrections

WordFileMBS.MediaFiles as String()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 16.3 Yes Yes Yes No No
Function: Lists the media files in the word document.
Notes: e.g. image1.png

Feedback, Comments & Corrections

WordFileMBS.Parts as String()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 16.2 Yes Yes Yes No No
Function: Queries names of the parts of the document.
Example:
dim f as FolderItem = GetFolderItem("test.docx")
dim b as BinaryStream = BinaryStream.Open(f)
dim d as string = b.Read(b.Length)
dim w as WordFileMBS = WordFileMBS.OpenData(d)

MsgBox w.XML("footer1")
Notes:
This may tell you how many headers/footers we found in a docx file.
e.g. "footer1", "header1", "document".

Feedback, Comments & Corrections

WordFileMBS.RemoveTableRow(tag as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 17.0 Yes Yes Yes Yes No
Function: Removes a table row containing a placeholder.
Notes:
If you have tables in your template word file and you only fill some rows, you can remove superfluous rows using this function.

Returns Values
0success
1Tag not found.
2Tag found, but not in a table.
3Missing main document part.

Feedback, Comments & Corrections

WordFileMBS.ReplaceTag(tag as string, text as string = "", All as boolean = false) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 15.4 Yes Yes Yes Yes No
Function: Replaces a placeholder with text.
Example:
dim f as FolderItem = GetFolderItem("test.docx")
dim b as BinaryStream = BinaryStream.Open(f)
dim d as string = b.Read(b.Length)
dim w as WordFileMBS = WordFileMBS.OpenData(d)

if w.ReplaceTag("FirstName", "Peter") then
if w.ReplaceTag("LastName", "Miller") then

f = GetFolderItem("output.docx")
if w.WriteFile(f) then
MsgBox "OK"
end if
end if
end if
Notes:
The place holder in the document must start with « and end with » characters. The place holder you pass here, should not have those quotes.
Returns true on success or false on failure.
If you need to replace multi line text like addresses, please use several placeholders, at least one per line.

Version 17.0 and newer can handle multi line text better for normal paragraphs. It creates for you new paragraphs for each line in the new text.

Feedback, Comments & Corrections

WordFileMBS.SetMarkers(openMarker as String, closeMarker as String) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 16.3 Yes Yes Yes No No
Function: Sets the markers to look for before/after a tag.
Notes:
Default are « and ».
Should be different and not empty.
Returns true on success or false on failure.

Feedback, Comments & Corrections

WordFileMBS.WriteFile(path as folderItem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Wordfile MBS XL Plugin 15.4 Yes Yes Yes Yes No
Function: Writes a file to disk.
Example:
dim f as FolderItem = GetFolderItem("test.docx")
dim b as BinaryStream = BinaryStream.Open(f)
dim d as string = b.Read(b.Length)
dim w as WordFileMBS = WordFileMBS.OpenData(d)

if w.ReplaceTag("FirstName", "Peter") then
if w.ReplaceTag("LastName", "Miller") then

f = GetFolderItem("output.docx")
if w.WriteFile(f) then
MsgBox "OK"
end if
end if
end if
Notes: File extension should be correct, either docx or xml depending on what you loaded.

Feedback, Comments & Corrections

WordFileMBS.XML(part as String) as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Wordfile MBS XL Plugin 16.2 Yes Yes Yes No No
Function: Queries/Sets XML for a part.
Example:
dim f as FolderItem = GetFolderItem("test.docx")
dim b as BinaryStream = BinaryStream.Open(f)
dim d as string = b.Read(b.Length)
dim w as WordFileMBS = WordFileMBS.OpenData(d)

MsgBox Join(w.Parts, EndOfLine)
Notes:
See Parts array for possible parts.
(Read and Write computed property)

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS XL Plugin.




Links
MBS Xojo Plugins