How to create .docx file in iPhone app programmatically?
<p>Here is my code:-</p>

<pre><code>NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *temp =  @"Data to be written in file";
NSData *adata =[temp dataUsingEncoding:NSUTF8StringEncoding];
documentsDir = [documentsDir stringByAppendingPathComponent:@"/Document.docx"];
[adata writeToFile:documentsDir atomically:YES];
</code></pre>

<p>When i open this file in the document folder the problem that i face is that "File is invalid". Can anyone help?</p>

<p>Thanks</p>
