Search code examples
c#gembox-spreadsheet

Gembox Spreadsheet - Remove blank pages


I dont know how achieve this, I have to create an informative report with images. For this, I use an excell template (It helps me with the format and with the position of the text where to place the respective information). The images are generated perfectly. I convert this XLS to PDF with the property

DocumentToMemoryStream (excelTemplate, XlsxSaveOptions.XlsxDefault);

This report generate blank pages in the PDF. How can I remove these blank pages, before the excel is generated?

I have to remove this


Solution

  • I had a counter of the rows of the document I was writing on, thanks to the help of @Mario Z, I use this function, before the save and solve my problem of blank pages

    wsimgs.NamedRanges.SetPrintArea(wsimgs.Cells.GetSubrange("A1",CellRange.RowColumnToPosition (countRow, 10)));