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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Maintain gridlines when exporting to PDF

Thread ID:





130035 Apr 17,2017 10:32 PM UTC Apr 19,2017 04:14 AM UTC ASP.NET Web Forms 3
Tags: Spreadsheet
Don Mason
Asked On April 17, 2017 10:32 PM UTC

I am using aspnet webforms and rendering an Excel document in the Spreadsheet control (works awesome !)

When I export to PDF (SaveAsPDF) I loose all my gridlines.
Is there a style setting or property I need to set to maintain my gridlines?


Silambarasan I [Syncfusion]
Replied On April 18, 2017 12:23 PM UTC

Hi Don Mason, 
Thank you for using Syncfusion products. 
We have checked your requirement “Need to set to maintain my gridlines on PDF exporting” and it has been achieved as a workaround solution.  Please refer the following code example. 
<ej:Spreadsheet ID="Spreadsheet1" OnServerPdfExporting="Spreadsheet1_ServerPdfExporting" runat="server"> 
using Syncfusion.Pdf; 
using Syncfusion.ExcelToPdfConverter; 
protected void Spreadsheet1_ServerPdfExporting(object sender, Syncfusion.JavaScript.Web.SpreadsheetEventArgs e) 
    var args = e.Arguments; 
    //Convert Spreadsheet data as Stream 
    Stream streamData = Spreadsheet.Save(args["sheetModel"].ToString(), args["sheetData"].ToString(), ExportFormat.XLSX, ExcelVersion.Excel2013); 
    streamData.Position = 0; //Reset reader position 
    ExcelToPdfConverter converter = new ExcelToPdfConverter(streamData); 
    PdfDocument pdfDocument = new PdfDocument(); 
    Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings settings = new Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings(); 
    settings.DisplayGridLines = GridLinesDisplayStyle.Visible; //Setting option to visible Gridlines 
    pdfDocument = converter.Convert(settings); 
    pdfDocument.Save("Sample.pdf", Response, HttpReadType.Save); 
For your convenience, we have prepared a sample to demonstrate this and the same can be downloaded from the below link. 
Could you please check the above sample and let us know whether is this fulfilling your requirement, if not please share us more information regarding this so that we can analyze based on that and provide you a better solution. The information provided would be great help for us to proceed further. 

Don Mason
Replied On April 18, 2017 05:05 PM UTC

works awesome.

Thank You

Silambarasan I [Syncfusion]
Replied On April 19, 2017 04:14 AM UTC

Hi Don Mason, 
Thanks for your update. 
We are happy to hear that your requirement has been achieved.  Kindly get back to us if you need further assistance.  We will be happy to help you out. 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon