Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Export Formats #92

Open
kunalkeshan opened this issue Nov 18, 2023 · 0 comments
Open

Additional Export Formats #92

kunalkeshan opened this issue Nov 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@kunalkeshan
Copy link
Owner

Besides CSV and JSON, you can offer additional export options depending on the nature of your data and user preferences. Here are some formats commonly used for data export:

  1. XML (Extensible Markup Language):

    const dataStr = 'data:text/xml;charset=utf-8,' + encodeURIComponent(xmlString);
  2. Excel (XLSX):
    You might need an external library like xlsx for this.

    const wb = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(exportJsonData), 'Sheet1');
    const dataStr = XLSX.write(wb, { bookType: 'xlsx', type: 'dataURL' });
  3. Plain Text:

    const dataStr = 'data:text/plain;charset=utf-8,' + encodeURIComponent(plainTextData);
  4. Markdown:

    const dataStr = 'data:text/markdown;charset=utf-8,' + encodeURIComponent(markdownString);
  5. HTML:

    const dataStr = 'data:text/html;charset=utf-8,' + encodeURIComponent(htmlString);
  6. YAML (YAML Ain't Markup Language):

    const dataStr = 'data:text/yaml;charset=utf-8,' + encodeURIComponent(yamlString);
  7. PDF:
    For PDF, you might need a library like jsPDF.

    const pdf = new jsPDF();
    pdf.text(10, 10, 'Your PDF Content');
    const dataStr = pdf.output('datauristring');
  8. Image Formats (PNG, JPEG):
    If applicable, you can export graphical data in image formats.

    const dataStr = 'data:image/png;base64,' + base64ImageString;

Always ensure that the chosen export format aligns with the data structure and user requirements. Additionally, consider providing options for customization, such as allowing users to select specific fields or data ranges for export.

@kunalkeshan kunalkeshan added the enhancement New feature or request label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant