Skip to content

Commit 661a84b

Browse files
sample
1 parent 198e95d commit 661a84b

31 files changed

+1417
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29512.175
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExportCustomization", "ExportCustomization\ExportCustomization.csproj", "{A5AB088F-F60A-4F42-90B3-82D1F0EEB6DC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A5AB088F-F60A-4F42-90B3-82D1F0EEB6DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A5AB088F-F60A-4F42-90B3-82D1F0EEB6DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A5AB088F-F60A-4F42-90B3-82D1F0EEB6DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A5AB088F-F60A-4F42-90B3-82D1F0EEB6DC}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B45F967B-AC1D-4388-A145-68E7A3FD877D}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Router AppAssembly="@typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
</Found>
5+
<NotFound>
6+
<LayoutView Layout="@typeof(MainLayout)">
7+
<p>Sorry, there's nothing at this address.</p>
8+
</LayoutView>
9+
</NotFound>
10+
</Router>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace ExportCustomization.Data
4+
{
5+
public class WeatherForecast
6+
{
7+
public DateTime Date { get; set; }
8+
9+
public int TemperatureC { get; set; }
10+
11+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12+
13+
public string Summary { get; set; }
14+
}
15+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Linq;
3+
using System.Threading.Tasks;
4+
5+
namespace ExportCustomization.Data
6+
{
7+
public class WeatherForecastService
8+
{
9+
private static readonly string[] Summaries = new[]
10+
{
11+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12+
};
13+
14+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
15+
{
16+
var rng = new Random();
17+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
18+
{
19+
Date = startDate.AddDays(index),
20+
TemperatureC = rng.Next(-20, 55),
21+
Summary = Summaries[rng.Next(Summaries.Length)]
22+
}).ToArray());
23+
}
24+
}
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Syncfusion.EJ2.Blazor" Version="17.3.0.28-beta" />
9+
</ItemGroup>
10+
11+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/counter"
2+
3+
<h1>Counter</h1>
4+
5+
<p>Current count: @currentCount</p>
6+
7+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8+
9+
@code {
10+
private int currentCount = 0;
11+
12+
private void IncrementCount()
13+
{
14+
currentCount++;
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@page "/error"
2+
3+
4+
<h1 class="text-danger">Error.</h1>
5+
<h2 class="text-danger">An error occurred while processing your request.</h2>
6+
7+
<h3>Development Mode</h3>
8+
<p>
9+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
10+
</p>
11+
<p>
12+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
13+
It can result in displaying sensitive information from exceptions to end users.
14+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
15+
and restarting the app.
16+
</p>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@page "/fetchdata"
2+
3+
@using ExportCustomization.Data
4+
@inject WeatherForecastService ForecastService
5+
6+
<h1>Weather forecast</h1>
7+
8+
<p>This component demonstrates fetching data from a service.</p>
9+
10+
@if (forecasts == null)
11+
{
12+
<p><em>Loading...</em></p>
13+
}
14+
else
15+
{
16+
<table class="table">
17+
<thead>
18+
<tr>
19+
<th>Date</th>
20+
<th>Temp. (C)</th>
21+
<th>Temp. (F)</th>
22+
<th>Summary</th>
23+
</tr>
24+
</thead>
25+
<tbody>
26+
@foreach (var forecast in forecasts)
27+
{
28+
<tr>
29+
<td>@forecast.Date.ToShortDateString()</td>
30+
<td>@forecast.TemperatureC</td>
31+
<td>@forecast.TemperatureF</td>
32+
<td>@forecast.Summary</td>
33+
</tr>
34+
}
35+
</tbody>
36+
</table>
37+
}
38+
39+
@code {
40+
private WeatherForecast[] forecasts;
41+
42+
protected override async Task OnInitializedAsync()
43+
{
44+
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
45+
}
46+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@page "/"
2+
3+
@using Syncfusion.EJ2.Blazor.Buttons
4+
@using Syncfusion.EJ2.Blazor.Grids
5+
6+
<EjsButton OnClick="ExcelExport" Content="Excel Export"></EjsButton>
7+
<EjsButton OnClick="PdfExport" Content="Pdf Export"></EjsButton>
8+
<EjsGrid @ref="DefaultGrid" DataSource="@Orders" AllowGrouping="true" AllowPdfExport="true" AllowExcelExport="true" AllowPaging="true">
9+
<GridGroupSettings Columns="@(new string[] {"CustomerID"})">
10+
</GridGroupSettings>
11+
<GridColumns>
12+
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
13+
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
14+
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
15+
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Visible="false" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
16+
</GridColumns>
17+
</EjsGrid>
18+
19+
@code{
20+
private EjsGrid<Order> DefaultGrid;
21+
22+
public List<Order> Orders { get; set; }
23+
24+
protected override void OnInitialized()
25+
{
26+
Orders = Enumerable.Range(1, 75).Select(x => new Order()
27+
{
28+
OrderID = 1000 + x,
29+
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
30+
Freight = 2.1 * x,
31+
OrderDate = DateTime.Now.AddDays(-x),
32+
}).ToList();
33+
}
34+
35+
public class Order
36+
{
37+
public int? OrderID { get; set; }
38+
public string CustomerID { get; set; }
39+
public DateTime? OrderDate { get; set; }
40+
public double? Freight { get; set; }
41+
}
42+
43+
public void ExcelExport()
44+
{
45+
ExcelExportProperties ExcelProperties = new ExcelExportProperties();
46+
ExcelProperties.FileName = "new.xlsx";
47+
ExcelProperties.DataSource = Orders.Where(x => x.CustomerID == "ALFKI").ToList();
48+
this.DefaultGrid.ClearGrouping();
49+
this.DefaultGrid.ExcelExport(ExcelProperties);
50+
this.DefaultGrid.GroupColumn("CustomerID");
51+
}
52+
public async void PdfExport()
53+
{
54+
PdfExportProperties ExportProperties = new PdfExportProperties();
55+
ExportProperties.FileName = "test.pdf";
56+
ExportProperties.DataSource = Orders.Where(x => x.CustomerID == "ALFKI").ToList();
57+
this.DefaultGrid.ClearGrouping();
58+
this.DefaultGrid.PdfExport(ExportProperties);
59+
this.DefaultGrid.GroupColumn("CustomerID");
60+
}
61+
62+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@page "/"
2+
@namespace ExportCustomization.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
@{
5+
Layout = null;
6+
}
7+
8+
<!DOCTYPE html>
9+
<html lang="en">
10+
<head>
11+
<meta charset="utf-8" />
12+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13+
<title>ExportCustomization</title>
14+
<base href="~/" />
15+
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
16+
<link href="css/site.css" rel="stylesheet" />
17+
<link href="https://cdn.syncfusion.com/ej2/17.3.28/fabric.css" rel="stylesheet" />
18+
<script src="https://cdn.syncfusion.com/ej2/17.3.28/dist/ej2.min.js"></script>
19+
<script src="https://cdn.syncfusion.com/ej2/17.3.28/dist/ejs.interop.min.js"></script>
20+
</head>
21+
<body>
22+
<app>
23+
<component type="typeof(App)" render-mode="ServerPrerendered" />
24+
</app>
25+
26+
<div id="blazor-error-ui">
27+
<environment include="Staging,Production">
28+
An error has occurred. This application may no longer respond until reloaded.
29+
</environment>
30+
<environment include="Development">
31+
An unhandled exception has occurred. See browser dev tools for details.
32+
</environment>
33+
<a href="" class="reload">Reload</a>
34+
<a class="dismiss">🗙</a>
35+
</div>
36+
37+
<script src="_framework/blazor.server.js"></script>
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)