Skip to content

Commit 5202885

Browse files
989214-EnableFileNameWithExtensionSample
1 parent cac3d01 commit 5202885

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="ShowFileNameWithExtension/ShowFileNameWithExtension.csproj" />
3+
</Solution>

Excel to PDF/Show file name with extension in PDF/.NET/ShowFileNameWithExtension/ShowFileNameWithExtension/Output/.gitkeep

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Syncfusion.XlsIO;
2+
using Syncfusion.Pdf;
3+
using Syncfusion.XlsIORenderer;
4+
5+
namespace ShowFileNameWithExtension
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
using (ExcelEngine excelEngine = new ExcelEngine())
12+
{
13+
IApplication application = excelEngine.Excel;
14+
application.DefaultVersion = ExcelVersion.Xlsx;
15+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
16+
17+
//Initialize XlsIORendererSettings
18+
XlsIORendererSettings settings = new XlsIORendererSettings();
19+
20+
//Enable ShowFileNameWithExtension property
21+
settings.ShowFileNameWithExtension = true;
22+
23+
//Initialize XlsIORenderer
24+
XlsIORenderer renderer = new XlsIORenderer();
25+
26+
//Convert the Excel document to PDF with renderer settings
27+
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook, settings);
28+
29+
#region Save
30+
//Saving the workbook
31+
pdfDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
32+
#endregion
33+
}
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="*" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<None Update="Output\*">
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</None>
18+
<None Update="Data\*">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
</None>
21+
</ItemGroup>
22+
23+
</Project>

0 commit comments

Comments
 (0)