Export docx to zipped html using google drive API
I am trying to export a docx file to zipped html using Google Drive API (Save as zipped html is one of the feature of google docs). But as per the documentation, supported export mime types are. https://developers.google.com/drive/manage-downloads
text/html
text/plain
application/rtf
application/vnd.oasis.opendocument.text
application/pdf
application/vnd.openxmlformats-officedocument.wordprocessingml.document
UPLOAD code
file = drive.files.insert.request_schema.new({
'title' => 'My document',
'description' => 'A test document',
'mimeType' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
}
)
media = Google::APIClient::UploadIO.new('gdoc.docx', 'application/msword')
result = client.execute(
:api_method => drive.files.insert,
:body_object => file,
:media => media,
:parameters => {
'uploadType' => 'multipart',
'convert' => 'true'
}
)
DOWNLOAD code
download_url = result.data.to_hash['exportLinks']['text/html']
html = client.execute(:uri => download_url)
Can anyone please tell me how can I export google doc to zipped html ?
I have the same problem.
Apparently export ing a Google Document to mimeType="text/html" using the drive-API, is NOT the same as clicking that same document's "File > Download-As > Web Page (.html, zipped)" menu item.
I wonder if the Google Folks could please shed some light on this asymmetry.
链接地址: http://www.djcxy.com/p/45494.html