RichText.WriteDOC
-----------------

Writes a Word file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RichText](component_RichText.md) | [3.5](newinversion35.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "RichText.WriteDOC"; Path ) 

**MBS**( **"RichText.WriteDOC";** /\* Writes a Word file. \*/  
**$Path**) /\* The native file path to the file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the file. | $path |

### Result

Returns OK or error.

### Description

Writes a Word file.  
Please set text with [RichText.SetFormattedText](RichTextSetFormattedText.md) or [RichText.SetText](RichTextSetText.md).  
And use [RichText.SetAttribute](RichTextSetAttribute.md) to set properties for document.  
  
Warning: The plugin can only read/write the styles/formats which Apple supports for their cocoa framework.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Convert html to Word file:

 Set Variable \[ $r ; Value: MBS ( "[RichText.ReadHTML](RichTextReadHTML.md)"; "&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;b&gt;Schokoladenplätzchen&lt;/b&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;" ) \]   
Set Variable \[ $r ; Value: MBS ( "RichText.WriteDOC"; "/Users/cs/Desktop/test.doc" ) \]  
### See also

- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [RichText.ReadHTML](RichTextReadHTML.md)
- [RichText.SetAttribute](RichTextSetAttribute.md)
- [RichText.SetFormattedText](RichTextSetFormattedText.md)
- [RichText.SetText](RichTextSetText.md)
- [RichText.WriteFile](RichTextWriteFile.md)
- [RichText.WritePDF](RichTextWritePDF.md)
- [RichText.WriteRTF](RichTextWriteRTF.md)

### Example Databases

- [Mac only/RichText/RichText](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/RichText/RichText.shtml#5ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 25th November 2017

  
[RichText.WriteContainer](RichTextWriteContainer.md) - [RichText.WriteFile](RichTextWriteFile.md)

[HTML Version](RichTextWriteDOC.shtml)