Skip to content

Commit 08b2e0a

Browse files
authored
Merge pull request #1 from DevExpress-Examples/fp-update-project
update project
2 parents b0d6440 + 9b99d70 commit 08b2e0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+223
-14089
lines changed

CS/BlazorAppSpreadsheet.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35527.113 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorAppSpreadsheet", "BlazorAppSpreadsheet\BlazorAppSpreadsheet.csproj", "{320F556D-39EC-4DB7-BC8B-5561F93279DF}"
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+
{320F556D-39EC-4DB7-BC8B-5561F93279DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{320F556D-39EC-4DB7-BC8B-5561F93279DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{320F556D-39EC-4DB7-BC8B-5561F93279DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{320F556D-39EC-4DB7-BC8B-5561F93279DF}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
8+
89
<ItemGroup>
9-
<PackageReference Include="DevExpress.Blazor" Version="24.2.1-alpha-24207" />
10-
<PackageReference Include="DevExpress.Document.Processor" Version="24.2.1-alpha-24207" />
10+
<Content Remove="Components\Layout\NavMenu.razor" />
1111
</ItemGroup>
12+
13+
<ItemGroup>
14+
<None Remove="Components\Layout\NavMenu.razor.css" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="DevExpress.Blazor" Version="24.2.3" />
19+
<PackageReference Include="DevExpress.Document.Processor" Version="24.2.3" />
20+
<PackageReference Include="DevExpress.Drawing.Skia" Version="24.2.3" />
21+
</ItemGroup>
22+
1223
<ItemGroup>
1324
<None Update="Data\LoanAmortizationScheduleTemplate.xltx">
1425
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1526
</None>
1627
</ItemGroup>
17-
</Project>
28+
29+
</Project>

CS/BlazorApp_SpreadsheetDocumentAPI/Code/DocumentGenerator.cs renamed to CS/BlazorAppSpreadsheet/Code/DocumentGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Drawing;
33
using DevExpress.Spreadsheet;
44

5-
namespace BlazorApp_SpreadsheetDocumentAPI
5+
namespace BlazorAppSpreadsheet
66
{
77
public class LoanAmortizationScheduleGenerator
88
{
@@ -203,4 +203,4 @@ void SpecifyPrintOptions()
203203
Sheet.PrintOptions.FitToHeight = 0;
204204
}
205205
}
206-
}
206+
}

CS/BlazorApp_SpreadsheetDocumentAPI/Code/DocumentService.cs renamed to CS/BlazorAppSpreadsheet/Code/DocumentService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System;
22
using System.IO;
33
using System.Threading.Tasks;
4+
using BlazorAppSpreadsheet;
45
using DevExpress.Spreadsheet;
56

6-
namespace BlazorApp_SpreadsheetDocumentAPI
7+
namespace BlazorAppSpreadsheet
78
{
89
public class DocumentService
910
{
@@ -58,4 +59,4 @@ async Task<Workbook> GenerateDocumentAsync(double loanAmount,
5859
return workbook;
5960
}
6061
}
61-
}
62+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
9+
<link rel="stylesheet" href="app.css" />
10+
<link rel="stylesheet" href="BlazorAppSpreadsheet.styles.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.css" rel="stylesheet" />
13+
14+
<HeadOutlet />
15+
</head>
16+
17+
<body>
18+
<Routes />
19+
<script src="_framework/blazor.web.js"></script>
20+
</body>
21+
22+
</html>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
5+
<main>
6+
<div class="top-row px-4">
7+
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
8+
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.css" rel="stylesheet" />
9+
</div>
10+
11+
<article class="content px-4">
12+
@Body
13+
</article>
14+
</main>
15+
</div>
16+
17+
<div id="blazor-error-ui">
18+
An unhandled error has occurred.
19+
<a href="" class="reload">Reload</a>
20+
<a class="dismiss">🗙</a>
21+
</div>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@page "/Error"
2+
@using System.Diagnostics
3+
4+
<PageTitle>Error</PageTitle>
5+
6+
<h1 class="text-danger">Error.</h1>
7+
<h2 class="text-danger">An error occurred while processing your request.</h2>
8+
9+
@if (ShowRequestId)
10+
{
11+
<p>
12+
<strong>Request ID:</strong> <code>@RequestId</code>
13+
</p>
14+
}
15+
16+
<h3>Development Mode</h3>
17+
<p>
18+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
19+
</p>
20+
<p>
21+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
22+
It can result in displaying sensitive information from exceptions to end users.
23+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
24+
and restarting the app.
25+
</p>
26+
27+
@code{
28+
[CascadingParameter]
29+
private HttpContext? HttpContext { get; set; }
30+
31+
private string? RequestId { get; set; }
32+
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
33+
34+
protected override void OnInitialized() =>
35+
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
36+
}

CS/BlazorApp_SpreadsheetDocumentAPI/Pages/Index.razor renamed to CS/BlazorAppSpreadsheet/Components/Pages/Home.razor

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
@page "/"
2+
@rendermode InteractiveServer
3+
@using System.Globalization
4+
@using Microsoft.AspNetCore.WebUtilities
25
@inject DocumentService DocumentService
36
@inject IJSRuntime JS
47

@@ -8,10 +11,11 @@
811
<DxFormLayoutItem ColSpanMd="12">
912
<Template>
1013
<p>
11-
This example uses the
12-
<a href="https://www.devexpress.com/products/net/office-file-api/spreadsheet/">Spreadsheet Document API</a>
13-
to create a loan amortization schedule. Specify the loan amount, loan period in years,
14-
annual interest rate, and start date to calculate your loan payments. Click <b>Export to XLSX</b>
14+
This example uses the Spreadsheet Document API
15+
to create a loan amortization schedule.
16+
Specify the loan amount, loan period in years,
17+
annual interest rate, and start date to calculate
18+
your loan payments. Click <b>Export to XLSX</b>
1519
or <b>Export to PDF</b> to save the result as XLSX or PDF.
1620
</p>
1721
</Template>
@@ -66,14 +70,14 @@
6670

6771
<DxFormLayoutItem ColSpanMd="12">
6872
<Template>
69-
<iframe class="col p-0 preview" height="500" src="@content"/>
73+
<iframe class="col p-0 preview" height="500" width="1100" src="@content" />
7074
</Template>
7175
</DxFormLayoutItem>
7276
</DxFormLayoutGroup>
7377
</DxFormLayout>
7478
</div>
7579

76-
@code{
80+
@code {
7781
string content = String.Empty;
7882
double loanAmount = 19000;
7983
int periodInYears = 2;
@@ -121,10 +125,10 @@
121125
content = "data:text/html;base64," + Convert.ToBase64String(document);
122126
}
123127

124-
void ExportToXlsx(MouseEventArgs args) => JS.InvokeAsync<object>("open",
128+
async Task ExportToXlsx(MouseEventArgs args) => await JS.InvokeAsync<object>("open",
125129
GetQueryString("api/Export/Xlsx"), "_self");
126130

127-
void ExportToPdf(MouseEventArgs args) => JS.InvokeAsync<object>("open",
131+
async Task ExportToPdf(MouseEventArgs args) => await JS.InvokeAsync<object>("open",
128132
GetQueryString("api/Export/Pdf"), "_self");
129133

130134
string GetQueryString(string uri)
@@ -137,4 +141,4 @@
137141
};
138142
return QueryHelpers.AddQueryString(uri, queryParams);
139143
}
140-
}
144+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Router AppAssembly="typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
4+
<FocusOnNavigate RouteData="routeData" Selector="h1" />
5+
</Found>
6+
</Router>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
@using System.Net.Http
1+
@using System.Net.Http
22
@using Microsoft.AspNetCore.Authorization
33
@using Microsoft.AspNetCore.Components.Authorization
44
@using Microsoft.AspNetCore.Components.Forms
55
@using Microsoft.AspNetCore.Components.Routing
66
@using Microsoft.AspNetCore.Components.Web
77
@using Microsoft.AspNetCore.Components.Web.Virtualization
88
@using Microsoft.JSInterop
9-
@using BlazorApp_SpreadsheetDocumentAPI
10-
@using BlazorApp_SpreadsheetDocumentAPI.Shared
9+
@using BlazorAppSpreadsheet
10+
@using BlazorAppSpreadsheet.Components
1111
@using DevExpress.Blazor
1212
@using Microsoft.AspNetCore.WebUtilities
1313
@using System.Globalization
14+
@using static Microsoft.AspNetCore.Components.Web.RenderMode

0 commit comments

Comments
 (0)