Copy link to clipboard
Copied
Hi, testing out this API for generating docx files but I am encountering the following error when attempting to open the generated files:
When I click yes and recover the contents, the document seems to be generated correctly.
Any advice on how to resolve this error message?
Copy link to clipboard
Copied
If you are using the REST API, remember that the result is a multipart form response you need to parse to get the binary data of your file.
Copy link to clipboard
Copied
Hi Raymond - I've been parsing that to get what I believe is the raw file data:
I interpret the raw file data as starting after the 'name="multipartLabel" ' string of text, and ending at the next boundary identifier:
Is there any best practice or code examples for converting the raw string into a docx file?
Copy link to clipboard
Copied
Well, it (Multpart Form Response) is a spec you can read to get the _exact_ rules on parsing. I'd say Google for that and the platform of your choice. So for example, if you are on PHP, google for "php multipart form response".
Copy link to clipboard
Copied
Thanks Raymond - I'm using Xano, which is a no-code development platform. I believe I am parsing the multipart correctly to obtain the raw word doc data - issue might be with the way the platform creates the docx using the raw data. What's the usual process for saving the raw data to a file? For example, how would I go about creating the docx file in a language like Python? Thanks.
Copy link to clipboard
Copied
Um, so I don't know the code to parse multipart in Python. It _should_ just be binary data that you save. Once you get the binary part I mean.