{"id":10920631,"url":"https://github.com/wnabil/ngx-export-as","last_synced_at":"2025-04-06T22:08:39.972Z","repository":{"id":47446479,"uuid":"110823526","full_name":"wnabil/ngx-export-as","owner":"wnabil","description":"Angular 2+ / Ionic 2+ HTML/table element to export it as JSON, XML, PNG, CSV, TXT, MS-Word, Ms-Excel, PDF","archived":false,"fork":false,"pushed_at":"2024-04-25T12:18:44.000Z","size":1488,"stargazers_count":66,"open_issues_count":1,"forks_count":38,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-26T01:19:34.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wnabil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-15T11:14:08.000Z","updated_at":"2024-06-18T15:28:12.188Z","dependencies_parsed_at":"2024-06-18T15:27:36.960Z","dependency_job_id":"638e17bf-63e7-4f35-905b-5ae141625522","html_url":"https://github.com/wnabil/ngx-export-as","commit_stats":{"total_commits":80,"total_committers":8,"mean_commits":10.0,"dds":0.55,"last_synced_commit":"61e17a45067e61793491a6f67dcf88021b1ac148"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnabil%2Fngx-export-as","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnabil%2Fngx-export-as/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnabil%2Fngx-export-as/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wnabil%2Fngx-export-as/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wnabil","download_url":"https://codeload.github.com/wnabil/ngx-export-as/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-06-08T14:33:03.077Z","updated_at":"2025-04-06T22:08:39.952Z","avatar_url":"https://github.com/wnabil.png","language":"JavaScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["CSV"],"readme":"# Angular 2+/Ionic 2+ Html to file export\n#### Typescript angular module to export Table/HTML to popular file formats\n\n[![npm version](https://badge.fury.io/js/ngx-export-as.svg)](https://badge.fury.io/js/ngx-export-as)  \n\nA simple module to export the html or table elements to downloadable file.\n## Supported Formats:\n  - Image - .png\n  - PDF - .pdf\n  - CSV - .csv\n  - Text - .txt\n  - Microsoft Excel sheets - .xls, .xlsx\n  - Microsoft Word documents - .doc, .docx \"REQUIRES TARGET CONFIG es2015\" [source issue](https://github.com/privateOmega/html-to-docx/issues/3#issuecomment-886222607)\n  - JSON - .json\n  - XML - .xml\n\n## Used libraries \"Useful for custom format options\"\n  - PNG - [HTML2Canvas](https://github.com/niklasvh/html2canvas/)\n  - PDF - [HTML2PDF](https://github.com/eKoopmans/html2pdf.js)\n  - Microsoft Excel sheets - [SheetJS js-xlsx](https://github.com/SheetJS/js-xlsx)\n  - Microsoft Word documents - [html-docx-js](https://github.com/evidenceprime/html-docx-js) \n\n## Demo\n Running the demo:\n```bash\ngit clone https://github.com/wnabil/ngx-export-as.git\ncd ngx-export-as\nnpm install\nng build ngx-export-as\nng serve\n```\nThen navigate to `localhost:4200` via your browser.\n\n## Get Started\n**(1)** Get Angular export as package:\n\n```bash\nnpm install --save ngx-export-as\n```\n\n**(2)** import `ngx-export-as` in your `app.module.ts` and `imports` array.\n\n```javascript\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\n\nimport { ExportAsModule } from 'ngx-export-as';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    ExportAsModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\n```\n\n**(3)** Import `'ExportAsService, ExportAsConfig'` into your component.\n\n```javascript \nimport { ExportAsService, ExportAsConfig } from 'ngx-export-as';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n  exportAsConfig: ExportAsConfig = {\n    type: 'png', // the type you want to download\n    elementId: 'myTableElementId', // the id of html/table element\n  }\n  constructor(private exportAsService: ExportAsService) { }\n\n}\n```\n\n**(4)** Use the available methods into your component to download or get the required data type.\n\n```javascript \n  function export() {\n    // download the file using old school javascript method\n    this.exportAsService.save(this.exportAsConfig, 'My File Name').subscribe(() =\u003e {\n      // save started\n    });\n    // get the data as base64 or json object for json type - this will be helpful in ionic or SSR\n    this.exportAsService.get(this.config).subscribe(content =\u003e {\n      console.log(content);\n    });\n  }\n```\n\n## IE Users\n - For Microsoft Internet Explorer this library requires many polyfills, please enable all BROWSER POLYFILLS.\n - [typedarray](https://github.com/inexorabletash/polyfill/blob/master/typedarray.js) Custom polyfill is also required.\n - Please refere to `polyfills.ts` demo\n\n## Contribution, Ideas and pull requests are welcome, Please open an issue on Github or contact me on w.nabil@orangestudio.com if i didn't response in approx 2 days.\n\n## Configuration\n\nBasically all configurable options are wrapped into exportAsConfig object.\nFor the special options for each format alone please set your custom options inside exportAsConfig.options object.\nExample:\n\n```javascript\nconst exportAsConfig: ExportAsConfig = {\n  type: 'docx', // the type you want to download\n  elementId: 'myTableIdElementId', // the id of html/table element,\n  options: { // html-docx-js document options\n    orientation: 'landscape',\n    margins: {\n      top: '20'\n    }\n  }\n}\n```\n\n## Important Notes\n  - Json type get method will return the data in json object format not as base64\n  - Not all the libraries supports the html element, for example the json and xlsx formats required the element to be an HTML Table\n\n### Change Logs\n- **1.0.0**\n  - Initial release\n  - Implement all available methods\n\n- **1.1.0**\n  - Upgrade to Angular 6\n\n- **1.1.1**\n  - fix issue #5\n\n- **1.2.0**\n  - switch to ng lib, ng-packagr\n\n- **1.2.2**\n  - fix readme and license\n\n- **1.2.3**\n  - Fix issue #9 - update readme\n  - Fix issue #12 - Add support for internet explorer \"Please check the docs section for IE\"\n  - Fix issue #15 - Support for angular 4 and 5\n  - Fix issue #16 - add support for special language chars\n\n- **1.2.4**\n  - fix all pdf issues for html2canvas - #1, #3, #11\n\n- **1.2.6**\n  - Save method now will return a subscription, please make sure to trigger `.subscribe()`\n\n- **1.3.0**\n  - Upgrade to Angular 8\n\n- **1.3.1**\n  - Add support for PDF header, footer, page number and other possible actions before rendering - Thanks to Sreekanth2108 #35 fix #38\n\n- **1.4.0**\n  - Remove docx library as a temp solution for SSR builds, fix #21 - please use v1.3.1 until we have a new implementation for docx\n\n- **1.4.1**\n  - Update for Angular 9\n\n- **1.4.2**\n  - Fix #61 add support for any element type for pdf: available types now are string, element, canvas, img or element id\n\n- **1.5.0**\n  - Fix #84 Support for Angular 10, Thanks to kgish\n\n- **1.12.0**\n  - Upgrade to Angular 12\n\n- **1.12.1**\n  - fix #76 Re-enable docx \"project target es2015 is required\"\n\n- **1.12.2**\n  - fix #97, fix csv comma, Thanks to souradeep07\n\n- **1.13.0**\n  - fix #102, Upgrade to Angular 13\n\n- **1.14.1**\n  - fix #109, Angular 14\n  - DOCX is not supported [check this issue](https://github.com/privateOmega/html-to-docx/issues/145)\n\n- **1.15.0**\n  - fix #110, Support for Angular 15, Thanks to MuhAssar\n\n- **1.15.1**\n  - fix PR #112, html2canvas SSR fix, Thanks to enea4science\n\n- **1.16.0**\n  - Angular 16\n\n- **1.17.0**\n  - Angular 17 PR #114, thanks to MuhAssar\n\n- **1.18.0**\n  - Angular 18 PR #115, thanks to AileThrowmountain\n\n- **1.19.0**\n  - Angular 19 PR #116, thanks to ralphinevanbraak\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwnabil%2Fngx-export-as","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwnabil%2Fngx-export-as","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwnabil%2Fngx-export-as/lists"}