diff --git a/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields.slnx b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields.slnx new file mode 100644 index 00000000..3d5d9367 --- /dev/null +++ b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields.slnx @@ -0,0 +1,3 @@ + + + diff --git a/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Data/InputTemplate.xlsx b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Data/InputTemplate.xlsx new file mode 100644 index 00000000..939bd45f Binary files /dev/null and b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Data/InputTemplate.xlsx differ diff --git a/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/EnableFormFields.csproj b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/EnableFormFields.csproj new file mode 100644 index 00000000..8f7278d1 --- /dev/null +++ b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/EnableFormFields.csproj @@ -0,0 +1,30 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + Always + + + + + + + + + + Always + + + + diff --git a/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Output/.gitkeep b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Output/.gitkeep new file mode 100644 index 00000000..839cfaeb --- /dev/null +++ b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Output/.gitkeep @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EnableFormFields.Output +{ + class _ + { + } +} diff --git a/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Program.cs b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Program.cs new file mode 100644 index 00000000..386dee49 --- /dev/null +++ b/Excel to PDF/EnableFormFields/.NET/EnableFormFields/EnableFormFields/Program.cs @@ -0,0 +1,37 @@ +using System.IO; +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; + +namespace EnableFormFields +{ + class Program + { + static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); + + //Initialize XlsIORendererSettings + XlsIORendererSettings settings = new XlsIORendererSettings(); + + //Disable ExportBookmarks + settings.EnableFormFields = true; + + //Initialize XlsIORenderer + XlsIORenderer renderer = new XlsIORenderer(); + + //Convert the Excel document to PDF with renderer settings + PdfDocument pdfDocument = renderer.ConvertToPDF(workbook, settings); + + #region Save + //Saving the workbook + pdfDocument.Save(Path.GetFullPath("Output/FormFieldsInPDF.pdf")); + #endregion + } + } + } +} \ No newline at end of file