Skip to main content
Answer

Export content to a text file from a lucid extension

  • June 25, 2024
  • 3 replies
  • 95 views

Michel L
Forum|alt.badge.img+11

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.

Best answer by Richard Udell

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?

Comments

Richard Udell
Forum|alt.badge.img+8
  • Lucid support team
  • Answer
  • June 26, 2024

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?


Michel L
Forum|alt.badge.img+11
  • Author
  • June 26, 2024

Thanks for your reply.

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


Richard Udell
Forum|alt.badge.img+8
  • Lucid support team
  • June 26, 2024

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