Skip to content

Commit 7ca96bb

Browse files
992302-Superscript
1 parent cac3d01 commit 7ca96bb

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

FAQ/Superscript/.NET/Superscript for certain texts/SuperscriptForCertainTexts.sln

Whitespace-only changes.
Binary file not shown.

FAQ/Superscript/.NET/Superscript for certain texts/SuperscriptForCertainTexts/Output/.gitkeep

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Syncfusion.XlsIO;
2+
3+
class Program
4+
{
5+
static void Main(string[] args)
6+
{
7+
using (ExcelEngine excelEngine = new ExcelEngine())
8+
{
9+
IApplication application = excelEngine.Excel;
10+
application.DefaultVersion = ExcelVersion.Xlsx;
11+
//Create a workbook
12+
IWorkbook workbook = application.Workbooks.Open("../../../Data/Sample.xlsx");
13+
IWorksheet worksheet = workbook.Worksheets[0];
14+
15+
//Add Text
16+
IRange range = worksheet.Range["A1"];
17+
IRichTextString richText = range.RichText;
18+
19+
IFont superScript = workbook.CreateFont();
20+
superScript.Size = richText.GetFont(6).Size;
21+
superScript.FontName = richText.GetFont(6).FontName;
22+
superScript.Color = richText.GetFont(6).Color;
23+
superScript.Superscript = true;
24+
richText.SetFont(6, 6, superScript);
25+
26+
27+
//Save the workbook to disk in xlsx format
28+
workbook.SaveAs("../../../Output/Output.xlsx");
29+
}
30+
}
31+
32+
33+
}
34+
35+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<None Update="Output\*">
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</None>
18+
</ItemGroup>
19+
20+
</Project>

0 commit comments

Comments
 (0)