facebooktwittermenuarrow-up

GemBox Support Forum

DocumentModel.Load from cloud not only in local path

Anyone know how can i use a docx file from cloud to use as a template and use in my project using GemBox.Document.

Example that i need, but is not work.
string path = “example from cloud .docx (google drive / onedrive)”;

Example that works fine, in local path
//string path = “FindAndReplaceText.docx”;

What i need in the end
var document = DocumentModel.Load(path);

Hi William,

Yes, you can load a document from the remote path, but the URL must be a direct download link.

For instance, the URL from “Get Link” in Google Drive is not a direct download link (e.g. https://drive.google.com/file/d/xxxxxxxxxx/view?usp=sharing).

To get a direct link try using the Google Drive Direct Link Generator. After that, you can use the generated link like the following:

var document = DocumentModel.Load("https://drive.google.com/uc?export=download&id=xxxxxxxxxx", LoadOptions.DocxDefault);

I hope this helps.

Regards,
Mario

1 Like

Thank you Mario for the answer,

It worked it! Just to add, when i tried your solution, it wasnt working because i was trying use a document that i created in my google drive, I did exactly what you sad, but to work i needed to download the file as a docx extension and upload this file to drive again as a document .docx. I got the shared link and change for a direct link and use this new link in my application and worked!