{"id":13567029,"url":"https://github.com/optimistex/xlsx-template-ex","last_synced_at":"2025-04-04T01:30:57.427Z","repository":{"id":57401742,"uuid":"133827934","full_name":"optimistex/xlsx-template-ex","owner":"optimistex","description":"The template engine for generate xlsx documents","archived":false,"fork":false,"pushed_at":"2020-09-15T10:37:02.000Z","size":2256,"stargazers_count":25,"open_issues_count":4,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-23T22:39:32.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/optimistex.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}},"created_at":"2018-05-17T14:48:20.000Z","updated_at":"2023-04-24T19:09:33.000Z","dependencies_parsed_at":"2022-09-15T18:40:55.211Z","dependency_job_id":null,"html_url":"https://github.com/optimistex/xlsx-template-ex","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimistex%2Fxlsx-template-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimistex%2Fxlsx-template-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimistex%2Fxlsx-template-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/optimistex%2Fxlsx-template-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/optimistex","download_url":"https://codeload.github.com/optimistex/xlsx-template-ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107816,"owners_count":20884793,"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-08-01T13:02:21.966Z","updated_at":"2025-04-04T01:30:56.887Z","avatar_url":"https://github.com/optimistex.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Excel template engine\n\nThe Documentation available on languages:\n1. [English](https://github.com/optimistex/xlsx-template-ex#readme)\n2. [Русский](README.ru.md)\n\nSupported files: **xlsx**\n\nThe component implements making some template-based reports.\nIt has the flexible syntax similar to template expressions in the Angular framework. \n\n## The syntax\n\nSupported 2 types of expressions:\n* Output a property value: `{{value|pipe:arg1:argN}}`\n* Output an array data: `[[value|pipe:arg1:argN]]`\n\nWhere:\n* `value` - name of property that contain some value or an array\n* `pipe` - some function for additional processing some value\n* `arg1`, `argN` - arguments/parameters passing to a pipe function\n\n## Implemented expression variants\n\n* `{{propertyName}}` - output a value as is\n* `{{propertyName|date}}` - the value formatted as date (DD.MM.YYYY)\n* `{{propertyName|time}}` - the value formatted as time (hh:mm:ss) \n* `{{propertyName|datetime}}` - the value formatted as date and time (DD.MM.YYYY hh:mm:ss) \n* `{{fileName|image}}` - find a picture file by file name. \n    If the picture found, then it embed into a table cell \n* `{{propertyArrayName|find:propertyName:propertyValue}}` - find a value in the array `propertyArrayName` \n    that has the property `propertyName` that equal `propertyValue`\n* `{{propertyObjectName|get:propertyName}}` - return a value of the property `propertyArrayName` from the object `propertyObjectName`     \n\n* `[[array|repeat-rows:3]]` - process the array of values and output the content \n    into the section from 3 rows started from current.\n    The rows will be duplicated according to the size of the array.\n* `[[array|filter:propertyName:checkValue]]` - filter the array. \n    If provided only `propertyName`, then We will get an array of objects that contain the property.\n    If provided `propertyName` and `checkValue`, then We will get an array of objects that contain \n    the property `propertyName` with value `checkValue`.\n* `[[array|tile:blockRows:blockColumns:tileColumns]]` - process the array of values and output the data by blocks.\n    The source block defines by `blockRows` and `blockColumns`. \n    The block will be output in a grid with `tileColumns` number columns. \n    \n## Examples\n\nWe will output this data:\n```javascript\nlet data = {\n    reportBuildDate: 1526443275041,\n\n    results: [\n        { text: 'some text 1', answerText: 'a text of an answer 1'},\n        { text: 'some text 2', answerText: 'a text of an answer 2'},\n        { text: 'some text 3', answerText: 'a text of an answer 3'},\n        { answerText: 'a text of an answer 3'},\n    ],\n};\n```\n    \nLet's make a template:\n\n**!!!** In the example / used instead of | because of a trouble with the markdown syntax \n\n| A | B |\n|---|---|\n|{{reportBuildDate/date}}| {{results/find:text:some text 2/get:answerText}} |\n|[[results/filter:text/repeat-rows:1]] {{text}}| {{answerText}} |\n| | |\n| [[results/filter:text/tile:1:1:2]]{{answerText}} | |\n\nReceived result:\n\n| A     | B     |\n|-------|-------|\n| 16.05.2018 | a text of an answer 2 |\n| some text 1 | a text of an answer 1 |\n| some text 2 | a text of an answer 2 |\n| some text 3 | a text of an answer 3 |\n| | |\n| a text of an answer 1 | a text of an answer 2 |\n| a text of an answer 3 | |\n\n## Get started\n\n```javascript\nconst fs = require(\"fs\");\nconst XlsxTemplate = require('xlsx-template-ex');\n\nconst data = {\n    reportBuildDate: 1526443275041,\n\n    results: [\n        { text: 'some text 1', answerText: 'a text of an answer 1'},\n        { text: 'some text 2', answerText: 'a text of an answer 2'},\n        { text: 'some text 3', answerText: 'a text of an answer 3'},\n        { answerText: 'a text of an answer 3'},\n    ],\n};\n\nXlsxTemplate.xlsxBuildByTemplate(data, 'template-file.xlsx')\n    .then((buffer) =\u003e fs.writeFileSync('./out.xlsx', buffer))\n    .catch((error) =\u003e console.log('xlsxHelper error:', error));\n```\n\n## Troubleshooting\n\nPlease follow this guidelines when reporting bugs and feature requests:\n\n1. Use [GitHub Issues](https://github.com/optimistex/xlsx-template-ex/issues) board to report bugs and feature requests (not our email address)\n2. Please **always** write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.\n\nThanks for understanding!\n\n## Contribute\n\n- `npm start` - Run the demo from a production build.\n- `npm run start-dev` - Run the demo in a developing mode.\n- `npm run build` - Build the demo for production.\n\n# License\n\nThe MIT License (see the [LICENSE](https://github.com/optimistex/xlsx-template-ex/blob/master/LICENSE) file for the full text)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimistex%2Fxlsx-template-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimistex%2Fxlsx-template-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimistex%2Fxlsx-template-ex/lists"}