Skip to content

968947-Add KB for compute grades based on score thresholds #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Use Cases/Student Rank/.NET/StudentRank/StudentRank.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36221.1 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentRank", "StudentRank\StudentRank.csproj", "{74DF17A2-0297-4BA1-A7BE-C8E5FF2186E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{74DF17A2-0297-4BA1-A7BE-C8E5FF2186E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74DF17A2-0297-4BA1-A7BE-C8E5FF2186E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74DF17A2-0297-4BA1-A7BE-C8E5FF2186E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74DF17A2-0297-4BA1-A7BE-C8E5FF2186E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {729FF827-E15D-4257-A56F-BC88645126FA}
EndGlobalSection
EndGlobal
Binary file not shown.
Empty file.
38 changes: 38 additions & 0 deletions Use Cases/Student Rank/.NET/StudentRank/StudentRank/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Syncfusion.XlsIO;

class Program
{
public static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.xlsx"), FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorksheet worksheet = workbook.Worksheets[0];

worksheet["E1"].Text = "Rank";
worksheet["E1"].CellStyle.Font.Bold = true;

//Apply grading logic using nested IF formulas
worksheet["E2"].Formula = "=IF(D2>=270,\"A\", IF(D2>=250,\"B\", IF(D2>=230,\"C\",\"D\")))";
worksheet["E3"].Formula = "=IF(D3>=270,\"A\", IF(D3>=250,\"B\", IF(D3>=230,\"C\",\"D\")))";
worksheet["E4"].Formula = "=IF(D4>=270,\"A\", IF(D4>=250,\"B\", IF(D4>=230,\"C\",\"D\")))";
worksheet["E5"].Formula = "=IF(D5>=270,\"A\", IF(D5>=250,\"B\", IF(D5>=230,\"C\",\"D\")))";
worksheet["E6"].Formula = "=IF(D6>=270,\"A\", IF(D6>=250,\"B\", IF(D6>=230,\"C\",\"D\")))";
worksheet["E7"].Formula = "=IF(D7>=270,\"A\", IF(D7>=250,\"B\", IF(D7>=230,\"C\",\"D\")))";

//Align given range to the right
worksheet.Range["E2:E7"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignRight;

//Saving the workbook
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(outputStream);

//Dispose streams
outputStream.Dispose();
inputStream.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>