Skip to content

Commit b04f0ce

Browse files
author
m.r
committed
V 5.2.0
1 parent c607f40 commit b04f0ce

13 files changed

+1684
-1300
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Version 5.2.0 (2024-02-08)
4+
5+
### New Features
6+
7+
- `generateCSV` & `generateText` functions create files in different formats, namely .csv and .txt
8+
39
## Version 5.1.1 (2024-01-31)
410

511
### Bug Fixes

README.md

+153
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ MR-Excel is a JavaScript library designed for reading and writing Excel files. T
4747
- [**`How to use themeBaseGenerate`**](#theme-base-generate-usage)
4848
- [**`extractExcelData`**](#extract-excel-data)
4949
- [**`How to use extractExcelData`**](#extract-excel-data-usage)
50+
- [**`🆕 generateCSV && generateText`**](#generate-csv-txt)
51+
- [**`🆕 How to use generateCSV && generateText`**](#generate-csv-txt-usage)
5052
- [**`interface`**](#interface)
5153
- [**`Migrate Version`**](#migrate)
5254
- [**`Migrating from 4 to 5`**](#migrating-4)
@@ -81,6 +83,10 @@ We have four functions that are defined with specific use cases as follows:
8183

8284
- **`extractExcelData`**: We provide 'extract-excel-data-usage,' which takes the URL of an Excel file that needs to be read, retrieves and reads the data, and returns an object containing the sheets as the result.
8385

86+
<a id="generate-csv-txt"></a>
87+
88+
- **`🆕 generateCSV && generateText`**:The generateCSV function produces a .csv file based on the excelTable output, while the generateText function generates a .txt file. This function includes a boolean property; if set to true, the generated files will be compressed into a zip file. It is important to note that .csv and .txt files do not support styles, formulas, and other similar features.
89+
8490
<a id="installation"></a>
8591

8692
## Installation [⬆️](#table-of-contents)
@@ -446,12 +452,153 @@ ExcelTable.convertTableToExcel("#table", null, true, rowF, colF)
446452

447453
</details>
448454

455+
<a id="extract-excel-data-usage"></a>
456+
449457
### How to use extractExcelData
450458

451459
```javascript
452460
ExcelTable.extractExcelData(your excel url);
453461
```
454462

463+
<a id="generate-csv-txt-usage"></a>
464+
465+
### 🆕 How to use generateCSV && generateText
466+
467+
<details>
468+
469+
<summary>Display Code</summary>
470+
471+
```javascript
472+
const data = {
473+
sheet: [
474+
{
475+
headers: [
476+
{
477+
label: "test",
478+
text: "Test",
479+
},
480+
{
481+
label: "_id",
482+
text: "ID",
483+
formula: {
484+
type: "MAX",
485+
styleId: "formulaStyle",
486+
},
487+
},
488+
],
489+
data: [
490+
{
491+
_id: 0.3,
492+
test: "test1",
493+
},
494+
{
495+
_id: 2,
496+
test: "test2",
497+
},
498+
{
499+
_id: 3,
500+
test: "test3",
501+
},
502+
{
503+
_id: 4,
504+
test: "test4",
505+
},
506+
{
507+
_id: 5,
508+
test: "test5",
509+
},
510+
{
511+
_id: 6,
512+
test: "test6",
513+
},
514+
{
515+
_id: 7,
516+
test: "test7",
517+
},
518+
{
519+
_id: 8,
520+
test: "test8",
521+
},
522+
{
523+
_id: 9,
524+
test: "test9",
525+
},
526+
{
527+
_id: 10,
528+
test: "test10",
529+
},
530+
{
531+
_id: 11,
532+
test: "test11",
533+
},
534+
],
535+
},
536+
{
537+
headers: [
538+
{
539+
label: "test",
540+
text: "Test",
541+
},
542+
{
543+
label: "_id",
544+
text: "ID",
545+
},
546+
],
547+
data: [
548+
{
549+
_id: 1,
550+
test: "test1",
551+
},
552+
{
553+
_id: 2,
554+
test: "test2",
555+
},
556+
{
557+
_id: 3,
558+
test: "test3",
559+
},
560+
{
561+
_id: 4,
562+
test: "test4",
563+
},
564+
{
565+
_id: 5,
566+
test: "test5",
567+
},
568+
{
569+
_id: 6,
570+
test: "test6",
571+
},
572+
{
573+
_id: 7,
574+
test: "test7",
575+
},
576+
{
577+
_id: 8,
578+
test: "test8",
579+
},
580+
{
581+
_id: 9,
582+
test: "test9",
583+
},
584+
{
585+
_id: 10,
586+
test: "test10",
587+
},
588+
{
589+
_id: 11,
590+
test: "test11",
591+
},
592+
],
593+
},
594+
],
595+
};
596+
ExcelTable.generateCSV(data, true);
597+
ExcelTable.generateText(data, true);
598+
```
599+
600+
</details>
601+
455602
<a id="side-by-side-line-by-line-usage"></a>
456603

457604
### How to use sideBySideLineByLine
@@ -8321,6 +8468,12 @@ To migrate from Version 2 to Version 3, you need to follow the steps below:
83218468

83228469
## Release Notes [⬆️](#table-of-contents)
83238470

8471+
## Version 5.2.0 (2024-02-08)
8472+
8473+
### New Features
8474+
8475+
- `generateCSV` & `generateText` functions create files in different formats, namely `.csv` and `.txt`
8476+
83248477
### Version 5.1.0 (2024-01-31)
83258478

83268479
#### New Features

change-log

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Version 5.1.1 (2024-01-31)
1+
## Version 5.2.0 (2024-02-08)
22

3-
### Bug Fixes
3+
### New Features
44

5-
- Fixed README.md
5+
- `generateCSV` & `generateText` functions create files in different formats, namely .csv and .txt

dist/excel-table.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,14 @@ declare interface FormulaSetting {
212212

213213
declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN";
214214

215+
export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): string[] | "done" | undefined;
216+
215217
export declare const generateExcel: typeof generateExcel_2;
216218

217219
declare function generateExcel_2(data: ExcelTable, styleKey?: string): Promise<string | number[] | Blob | Buffer | undefined>;
218220

221+
export declare function generateText(excelTable: ExcelTable, asZip?: boolean): string[] | "done" | undefined;
222+
219223
declare interface Header {
220224
label: string;
221225
text: string;

0 commit comments

Comments
 (0)