We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Date format when converting Excel to PDF


We are using SyncFusion to convert Excel files to PDF's however we have an issue with the date format applied to the cells, in Excel we have it in DD/MM/YYY however when converted to PDF it is applying M/D/YYY

Is there a setting to control this?

Thanks, Andy

3 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team April 24, 2023 10:54 AM UTC

Hi Andy,

Kindly share the input Excel document and confirm us the Syncfusion XlsIO version you are using at your end, to investigate the query further.



AN Andy April 24, 2023 11:03 AM UTC

Hi Keerthi,

Attached is a simple sample document. When we convert the document we get the below, where the dateformat is changed.

The XlsIO version from the dll is 20.2200.0.48

Thanks, Andy

Attachment: Book1_933fa2fd.zip

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team April 25, 2023 10:22 AM UTC

Thanks for sharing the file as requested, Andy.

DateTime format gets changed based on the system culture. If you wish to maintain the format irrespective of the system culture, we suggest you to set the required number format, before converting to PDF. Please find the code snippet below.

Code Snippet:

using (ExcelEngine excelEngine = new ExcelEngine())


    IApplication application = excelEngine.Excel;

    application.DefaultVersion = ExcelVersion.Xlsx;

    FileStream excelStream = new FileStream("Book1.xlsx", FileMode.Open, FileAccess.Read);

    IWorkbook workbook = application.Workbooks.Open(excelStream);


    IStyle style = workbook.Styles.Add("Style");

    style.NumberFormat = "DD/MM/YYYY";


    workbook.Worksheets[0].SetDefaultColumnStyle(1, style);


    //Initialize XlsIO renderer.

    XlsIORenderer renderer = new XlsIORenderer();


    //Convert Excel document into PDF document

    PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);


    MemoryStream stream = new MemoryStream();


    //Set the position as '0'.

    stream.Position = 0;

    //Download the PDF document in the browser.

    FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/pdf");

    fileStreamResult.FileDownloadName = "Sample.pdf";

    return fileStreamResult;


Kindly try and let us know if this helps.



Live Chat Icon For mobile
Up arrow icon