Reading Docx file into a TextArea

I’m trying to read a docx Word file into a TextArea but I’m only getting garbage characters. I’m using the MBS plugin.

dim f as FolderItem = GetOpenFolderItem(“text/docx”)
dim b as BinaryStream = BinaryStream.Open(f)
dim d as string = b.Read(b.Length)
dim w as WordFileMBS = WordFileMBS.OpenData(d)
textArea1.text = d

I would expect w to have a property to use not the raw file data d.

yeah i thought so too, but I get a type mismatch error that it’s expecting a string but got class WordFileMBS if I try

textField1.text = w

didn’t know if there was some property of the class I could use to extract the text. Could not find anything in the documentation.

As I recall, a docx file is actually a zip file and if you rename it you can unzip it and see its contents.

But yes, if WordFileMBS is what you are using then the solution is probably in there. Have you looked at the example projects that come with the plugin?

Check WordFileMBS in documentation.

not sure whether it does what you need, but you may just try w.text to get some text.

using “w.text” seems to work for the most part except for text in headers (and possibly footers). Thanks. I thought I’d tried that.