Free Support Forum -

Coverting from GridWeb to PDF File

Hi Team,

Could you please provide the sample code for directly converting from GridWeb to PDF File with same format.

I have converted xls file to PDF file using below code but PDF contains not proper alignment.Please help me on this as well.

string xlsFile = @"C:\Test1.xls";

string pdfFile = @"C:\Test1.pdf";

string pdfFile1 = @"C:\Test2.pdf";

Workbook wb1 = new Workbook(xlsFile);

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(xlsFile);

wb.Save(pdfFile, SaveFormat.Pdf);

wb1.Save(pdfFile1, SaveFormat.Pdf);

Thanks and Regards



Thanks for your posting and using Aspose.Cells for GridWeb.

We are afraid, this feature of converting your file into pdf file directly from GridWeb is not available.

Please first save your file into MemoryStream using this.GridWeb.WebWorksheets.SaveToExcelFile and then from there convert your file into pdf using Aspose.Cells for .NET API(s).

For not proper alignment issue, please post your file, we will look into your issue and help you asap.

We also recommend you to download and try the latest version: Aspose.Cells
for .NET v7.3.5.1
to see if it resolves your alignment issue.

Hi Team,

Thanks for your reply.I have converted excel file to PDF File.Excel file contians 20 columns and many rows but converted PDF file showing 3 colums in one page remaing showing after end of the rows.We need to show all the columns in one page wise.Please suggest for this issue.

And also please provide the code for showing date in PDF Landscape format while convert from excel to pdf file.

I have attached one xcel file and Converted PDF file for your reference.

Used code:


workbook wb =new workbook(Path);,"samplexceltoPFD.pfd",ContentDisposition.Attachment,new XlsSaveOptions(SaveFormat.Pdf));


Thanks and Regards


Hi Team,

Any update on the above issue.Please provide us the solution for urgent basis.

If any possible ways for decreasing the size and show in Lanscape format in PDF while convert from excel to PDF or Convert from AsposeGridWeb to PDF.

Thanks and Regards


Well, in latest version of Aspose.Cells.GridWeb v2.7.14.2000 (you may get it by installing the latest Aspose.Cells for .NET v7.3.5 MSI installer), we have supported more file formats for conversion e.g PDF, ODS, Tab Delimited, HTML etc. So, one can directly save the GridWeb to PDF for other formats.

Sample code:

GridWeb1.WebWorksheets.SaveToExcelFile("e:\\test2\\output.pdf", Aspose.Cells.GridWeb.Data.FileFormatType.PDF);

But, we still recommend you to kindly use Aspose.Cells component rather than directly using Aspose.Cells.GridWeb control for PDF conversion, see the topic:

You may also use PageSetup options before conversion:

Please check the document on how to render one page per sheet in the output PDF:

Note: Aspose.Cells render PDF file based on the print preview that is shown in Ms Excel for the sheets, so if you need to display all the columns in one page, your data will be too small to be read, you may confirm this behavior in Ms Excel, so it might not be worth showing everything in a single page.

Also for:
"If any possible ways for decreasing the size and show in Lanscape format in PDF while convert from excel to PDF or Convert from AsposeGridWeb to PDF."

If you need to manipulate PDF regarding size of the page or other options, please use Aspose.Pdf product. Please do contact Aspose.Pdf team by using Aspose.Pdf forum, they will help you soon there.

Thank you.