Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stormaref authored Jan 3, 2025
1 parent d70928b commit 37a2331
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
# Json2ExcelMiddleware
# Json2ExcelMiddleware

This middleware convert your .net controller json result to excel file without adding anything to any controller
**Json2ExcelMiddleware** allows you to effortlessly convert your .NET controller's JSON responses into Excel files with minimal setup.

how to add package:
## Installation

using pm>

```
Install the package via NuGet:
```bash
Install-Package Json2ExcelMiddleware -Version 1.2.4
```

how to use:

1) first add this line of code to your startup file configure section:

```c#
app.UseJson2Excel();
## How to Use

1. **Configure Middleware**
Add the following line to the `Configure` method in your `Startup.cs` after `app.UseRouting()`:
```csharp
app.UseJson2Excel();
```
2. **Set Header**
Include this header in your HTTP request:
```
x-excel:1
```
That’s it! The middleware works with all HTTP methods (GET, POST, PUT, etc.).

## Example
### Before
A typical JSON response:
```json
[
{ "Name": "Alice", "Age": 25 },
{ "Name": "Bob", "Age": 30 }
]
```
* after app.UseRouting()

2) add this header to your http request:

```
x-excel:1
```

that's it!
### After
Downloadable Excel file with the same data!

it works for every kind of http request (get,post,put,etc.)
## License
This project is licensed under [Apache License](https://github.com/stormaref/Json2ExcelMiddleware/blob/main/LICENSE)

0 comments on commit 37a2331

Please sign in to comment.