Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150841 | Jan 21,2020 06:10 PM UTC | Feb 7,2020 12:02 PM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: XlsIO |
//Instantiate ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Initialize IApplication
IApplication application = excelEngine.Excel;
//Set the default application version
application.DefaultVersion = ExcelVersion.Excel2013;
//Load the existing Excel docuemnt into IWorkbook
IWorkbook workbook = application.Workbooks.Open(Server.MapPath("App_Data/result.xlsx"), ExcelOpenType.Automatic);
//Initialize ExcelToPdfConverter
ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
//Initialize ExcelToPdfConverterSettings and disable the gridlines
ExcelToPdfConverterSettings converterSettings = new ExcelToPdfConverterSettings();
converterSettings.DisplayGridLines = GridLinesDisplayStyle.Invisible;
//Initialize PDF document
PdfDocument pdfDocument = new PdfDocument();
//Convert Excel document into PDF document
pdfDocument = converter.Convert(converterSettings);
//Open the document in browser after saving it
pdfDocument.Save("Output.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.