We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wide worksheet is clipped when converted to PDF

Hi - I’m not sure if this is a limitation of the software; but when I convert a particular workbook (a .xlsx file) to PDF, I’m getting a result that is clipped on the right. The worksheet is very very wide - approximately 3 and 2/3 monitors wide on a standard 1080p monitor. It clips at just beyond 2 1/2 monitor widths.


Thanks for your posting and using Aspose.Cells.

Please provide us your excel file that is getting clipped and also provide a screenshot highlighting the issue with red circles.

Please also download and try the latest version:

for .NET v8.6.2.5
and see if it makes any difference and resolves your issue. Thanks for your cooperation.

Hi, Aspose:

Attached is an example of the problem. First open the XLSX and scroll all the way to the right. Notice the months go through July. Then open the resulting PDF and notice the original data is clipped starting at April. Here’s the code I use:

void ConvertExcelToPdf(string inputFilename, string outputFilename)
// reference http://www.aspose.com/docs/display/cellsnet/Converting+Excel+to+PDF+Files
var doc = new Aspose.Cells.Workbook(inputFilename);
foreach (Aspose.Cells.Worksheet sheet in doc.Worksheets)
var ps = sheet.PageSetup;
ps.TopMarginInch = ps.LeftMarginInch = ps.RightMarginInch = ps.BottomMarginInch = MarginForNonformattedFiles;
ps.Orientation = Aspose.Cells.PageOrientationType.Landscape;
ps.PaperSize = ExcelPaperSize;
try { doc.CalculateFormula(ignoreError: true); }
catch { }
doc.Save(outputFilename, Aspose.Cells.SaveFormat.Pdf);

MarginForNonformattedFiles = 0.5, and ExcelPaperSize is set to Aspose.Cells.PaperSizeType.PaperA2.


Thanks for the template file and sample code.

I have evaluated your scenario/ case using your template file a bit. Well, this is not an issue with the component. The reason of your issue is simple, if you could open your template Excel file into Ms Excel, click the view tab and select the Page Break Preview, you will see that only specific printable area “B1:EZ69” is selected (you may also confirm that using Page Setup dialog box and check the Print area in “Sheet” tab of the dialog), so you are not getting all your data area in the output PDF file. In short, you got to remove this Print area either in MS Excel manually or using Aspose.Cells APIs as per code segment mentioned below (see the document on how to specify PageSetup options: http://www.aspose.com/docs/display/cellsnet/Setting+Print+Options) before rendering to PDF file format.
Sample code:

worksheet.PageSetup.PrintArea = “”;

Hope, this helps a bit.

Thank you.