Hello,
we’ve been using groupdocs viewer for some time and I have a question,
is there any way to convert an xlsx file or another containing sheets to PDF
in such a way that the whole sheet fits on the pdf page.
Of course, the start view may be blurry, but when you zoom in properly on the page, you will see individual cells and elements.
I know there is such an option in converting to html, but is it possible to convert to pdf like this?
Maybe you have a workaround or plan to do this feature?
@michalfordata
Sure, you can render a worksheet to a single page using the following code
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
namespace ViewerSampleApp
{
static class Program
{
static void Main()
{
using (Viewer viewer = new Viewer("sample.xlsx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
viewer.View(viewOptions);
}
}
}
}
Optionally, you can skip rendering of empty columns and empty rows
viewOptions.SpreadsheetOptions.SkipEmptyColumns = true;
viewOptions.SpreadsheetOptions.SkipEmptyRows = true;
Looking forward for your feedback.
1 Like
Thank you for your help
Somehow I missed it.