File tree Expand file tree Collapse file tree
Excel to PDF/EnableFormFields/.NET/EnableFormFields Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <Solution >
2+ <Project Path =" EnableFormFields/EnableFormFields.csproj" />
3+ </Solution >
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 >net8.0</TargetFramework >
6+ <ImplicitUsings >enable</ImplicitUsings >
7+ <Nullable >enable</Nullable >
8+ </PropertyGroup >
9+
10+ <ItemGroup >
11+ <None Remove =" Output\.gitkeep" />
12+ </ItemGroup >
13+
14+ <ItemGroup >
15+ <EmbeddedResource Include =" Output\*" >
16+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
17+ </EmbeddedResource >
18+ </ItemGroup >
19+
20+ <ItemGroup >
21+ <PackageReference Include =" Syncfusion.XlsIORenderer.Net.Core" Version =" *" />
22+ </ItemGroup >
23+
24+ <ItemGroup >
25+ <EmbeddedResource Include =" Data\*" >
26+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
27+ </EmbeddedResource >
28+ </ItemGroup >
29+
30+ </Project >
Original file line number Diff line number Diff line change 1+ using System;
2+ using System.Collections.Generic;
3+ using System.Linq;
4+ using System.Text;
5+ using System.Threading.Tasks;
6+
7+ namespace EnableFormFields.Output
8+ {
9+ class _
10+ {
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ using System . IO ;
2+ using Syncfusion . XlsIO ;
3+ using Syncfusion . XlsIORenderer ;
4+ using Syncfusion . Pdf ;
5+
6+ namespace EnableFormFields
7+ {
8+ class Program
9+ {
10+ static void Main ( string [ ] args )
11+ {
12+ using ( ExcelEngine excelEngine = new ExcelEngine ( ) )
13+ {
14+ IApplication application = excelEngine . Excel ;
15+ application . DefaultVersion = ExcelVersion . Xlsx ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
17+
18+ //Initialize XlsIORendererSettings
19+ XlsIORendererSettings settings = new XlsIORendererSettings ( ) ;
20+
21+ //Disable ExportBookmarks
22+ settings . EnableFormFields = true ;
23+
24+ //Initialize XlsIORenderer
25+ XlsIORenderer renderer = new XlsIORenderer ( ) ;
26+
27+ //Convert the Excel document to PDF with renderer settings
28+ PdfDocument pdfDocument = renderer . ConvertToPDF ( workbook , settings ) ;
29+
30+ #region Save
31+ //Saving the workbook
32+ pdfDocument . Save ( Path . GetFullPath ( "Output/FormFieldsInPDF.pdf" ) ) ;
33+ #endregion
34+ }
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments