The gem used has a ruby-ole pearl like addiction. You can see in the code :
ole = Ole::Storage.open(file)
When you import a Word document, it really opens with a ruby-ole stone. This gem will throw an exception if it cannot confirm that the file is in the correct format:
raise FormatError, "OLE2 signature is invalid" unless magic == MAGIC
MAGIC refers to the header of the .doc file, which should look like this:
This refers to the CFBF header format for Word documents:
BYTE _abSig[8]; // [00H,08] {0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, // 0x1a, 0xe1} for current version
Either your .doc file is not a valid Word document, or it was created by a newer version of Word that is not supported by the ruby-ole gem.
I recommend repeating the operation with several different Word documents to find a compatible type, and then re-saving the original document in this format to try again.
source share