File tree Expand file tree Collapse file tree 5 files changed +62
-0
lines changed
Excel to PDF/Show file name with extension in PDF/.NET/ShowFileNameWithExtension
ShowFileNameWithExtension Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ <Solution >
2+ <Project Path =" ShowFileNameWithExtension/ShowFileNameWithExtension.csproj" />
3+ </Solution >
Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments