WordFile.OpenContainer
----------------------

Opens a word file from container.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WordFile](component_WordFile.md) | [5.4](newinversion54.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "WordFile.OpenContainer"; Container ) 

**MBS**( **"WordFile.OpenContainer";** /\* Opens a word file from container. \*/  
**$Container**) /\* The container value containing the word file.e.g. MyTable::MyContainerField \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Container | The container value containing the word file. | MyTable::MyContainerField |

### Result

Returns reference number or error.

### Description

Opens a word file from container.  
Can be a docx or a xml file.  
Reference numbers for WordFiles start at 46000.  
  
Does not work for old .doc files!  
May break if newer versions of Microsoft Word or Office change the docx file format.  
May also work for docm files.  
### Examples

Open from container:

 #load from container   
Set Variable \[$wordfile ; Value:MBS ( "WordFile.OpenContainer"; WordFile::Input )\]  
\# later clean up   
Set Variable \[$r ; Value:MBS ("[WordFile.Release](WordFileRelease.md)"; $WordFile )\]  
Open word file and extract text:

 Set Variable \[$w ; Value:MBS ( "WordFile.OpenContainer"; Extract text from Word file::WordFile )\]  
If \[MBS ("iserror")\]  
 Show Custom Dialog \["Failed to read word file"; $w \]  
 Exit Script \[\]  
End If  
Set Field \[Extract text from Word file::Text ; MBS ( "[WordFile.Texts](WordFileTexts.md)"; $w )\]  
Set Variable \[$r ; Value:MBS ( "[WordFile.Release](WordFileRelease.md)"; $w )\]  
### See also

- [IsError](IsError.md)
- [UnZipFile.OpenContainer](UnZipFileOpenContainer.md)
- [WordFile.AppendTableRow](WordFileAppendTableRow.md)
- [WordFile.GetMediaFile](WordFileGetMediaFile.md)
- [WordFile.GetXML](WordFileGetXML.md)
- [WordFile.MediaFiles](WordFileMediaFiles.md)
- [WordFile.Release](WordFileRelease.md)
- [WordFile.ReplaceTag](WordFileReplaceTag.md)
- [WordFile.SetMediaFile](WordFileSetMediaFile.md)
- [XML.GetPathValue](XMLGetPathValue.md)

### Example Databases

- [WordFile/WordFile](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WordFile/WordFile.shtml#1ScriptAnchor_)

### FileMaker Magazin

- [Ausgabe 6/2021, Seite 20](https://filemaker-magazin.de/neuigkeit/4165-Appetithappen-FMM_202106)
- [Ausgabe 6/2016, Seite 38](https://filemaker-magazin.de/neuigkeit/3913-Appetithappen-FMM_201606)

This function checks for a license.

Created 5th November 2015 , last changed 2nd November 2023

  
[WordFile.MediaFiles](WordFileMediaFiles.md) - [WordFile.OpenFile](WordFileOpenFile.md)

[HTML Version](WordFileOpenContainer.shtml)