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

Free Support Forum - aspose.com

How to remove rows to repeat in last page when saved in pdf

Hi Aspose,

I’m using Aspose.Cells
My requirement is to add an image in the last page of the pdf.
Following is the sample code.
Workbook workbook = New Workbook(“Sample.xlsx”)
PageSetup pageSetup = workbook.Worksheets[0].PageSetup
pageSetup.RowsToRepeat = “$1:$2"
pageSetup.ColumnsToRepeat =”$A:$B"
workbook .Worksheets[0].HorizontalPageBreaks.Add(15)
workbook .Worksheets[0].Pictures.Add(15,0, “someImage.jpeg”)
In the saved pdf file what I’m getting is image and also data in first and second rows.
Can you please tell me is there anyway I can remove rows to repeat in the image page(last page) .i.e. page with only header footer and image.
Thanks and Regards


As a workaround, you can combine two workbooks and get the pdf.

Better approach will be to add a new worksheet with your image

Your first workbook will be your source file

And your second workbook will have your image.

You will append your second workbook to your first workbook and get the pdf of the resulted workbook.

This way, your image will always be at the last page.

Below is a code to combine workbooks and take their pdf


var firstWorkbook = new Aspose.Cells.Workbook(“first.xlsx”);

var secondWorkbook = new Aspose.Cells.Workbook(“second.xlsx”);


//Save the result workbook as PDF

firstWorkbook.Save(“output.pdf”, Aspose.Cells.SaveFormat.Pdf);