Skip to main content
Solved

Export content to a text file from a lucid extension

  • 25 June 2024
  • 3 replies
  • 37 views

Hi,

I would like to create an xml file from my process diagram to be able to automate some actions from the content of this file using a third party app.

How could i do that?

Could we use some javascript library like filesaver.js or simply use a few line of code like that:

// Create the URL with the data to export
const file = new File([data], fileName, { type: "text/plain" });
const exportUrl = URL.createObjectURL(file);
const a = document.createElement("a");
document.body.appendChild(a);
a.href = exportUrl;
a.download = fileName;
a.target = "_self";
a.click();
URL.revokeObjectURL(exportUrl);

In adding package in the package.json file?

Best regards.

Comments

Userlevel 4
Badge +7

Hi @Michel L, thanks for contributing to the Lucid for Developers Community!

To help you out, our Documents endpoint provides a Document Content resource. You can check out all the details in our API documentation. Additionally, our Lucid Standard Import lets you format JSON to import document elements into a new document. For some examples, take a look at the /standard-import folder in Lucid's repository of Sample Lucid REST Applications. You can also find some example .lucid ZIP files in there that might be useful for your projects here.

Just to clarify, are you looking to export the diagram to XML, modify it with a third-party app, and then re-import it into Lucidchart?

Userlevel 1
Badge +5

Thanks for your reply.

So I need to call REST api in my lucid extension right?

Userlevel 4
Badge +7

That is correct! Please let us know if need help troubleshooting errors if they come up.

Reply