You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,18 @@
1
1
# FileExporter
2
2
3
-
FileExporter is a lightweight C# library that simplifies file export operations in .NET applications. With support for exporting data to CSV, Excel (XLSX), and PDF formats, FileExporter provides an intuitive interface for developers to quickly generate and download files.
3
+
FileExporter is a lightweight C# library that simplifies file export operations in .NET applications. With support for
4
+
exporting data to CSV, Excel (XLSX), and PDF formats, FileExporter provides an intuitive interface for developers to
5
+
quickly generate and download files.
4
6
5
7
## Features
6
8
7
9
-**Easy Exporting**: Simply call ToCsv(), ToXlsx(), or ToPdf() on your data collection to export to the desired format.
8
-
-**Automatic Splitting**: Handles large datasets by automatically splitting files if the maximum line count or file size is exceeded, then zipping them for easy download.
10
+
-**Automatic Splitting**: Handles large datasets by automatically splitting files if the maximum line count or file
11
+
size is exceeded, then zipping them for easy download.
9
12
-**Flexible Configuration**: Customize export settings such as column headers, delimiter, and more to suit your needs.
10
13
-**Effortless Integration**: Seamlessly integrate FileExporter into your existing .NET projects with minimal setup.
11
-
-**Helper Extension Methods**: Use ToFileFormat(ExportType.Excel) as an alternative to directly calling ToCsv(), ToXlsx(), or ToPdf().
14
+
-**Helper Extension Methods**: Use ToFileFormat(ExportType.Excel) as an alternative to directly calling ToCsv(),
15
+
ToXlsx(), or ToPdf().
12
16
13
17
## Installation
14
18
@@ -38,11 +42,14 @@ var exportedFile = data.ToCsv().ToFile();
38
42
// Return the exported file to the caller
39
43
returnexportedFile;
40
44
```
45
+
41
46
Starting from release 3.3.0, FileExporter supports exporting data using fluent rules.
42
47
43
48
### Fluent Rules Example
44
49
45
-
First, create an ExportRule for your model. In the constructor, call GenerateRules() to automatically create default rules based on the model. To customize the setup, use the RuleFor() method to configure specific rules for your model's properties. Here's a quick demonstration:
50
+
First, create an ExportRule for your model. In the constructor, call GenerateRules() to automatically create default
51
+
rules based on the model. To customize the setup, use the RuleFor() method to configure specific rules for your model's
52
+
properties. Here's a quick demonstration:
46
53
47
54
### Model Example:
48
55
@@ -56,6 +63,7 @@ public class FileData
56
63
publicstring? Comment { get; set; }
57
64
}
58
65
```
66
+
59
67
### Export Rule Example:
60
68
61
69
This sample includes two constructors, one with a default name and one with a custom name.
@@ -95,6 +103,7 @@ public class FileDataExportRule : ExportRule<FileData>
95
103
}
96
104
}
97
105
```
106
+
98
107
If a property is incorrectly set up, an InvalidPropertyNameException will be thrown with a relevant message.
0 commit comments