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

Hi Aspose,

I’m using Aspose.Cells 7.1.1.0.
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”)
workbook.Save(“sample.pdf”,SaveFormat.Pdf)
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
Mukundan

Hi,

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

Note:
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

C#


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

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

firstWorkbook.Combine(secondWorkbook);

//Save the result workbook as PDF

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