Hi,
In order to generate an image of a specified range of cells, I used the PrintArea of the PageSetup to define the range and then used SheetToImage.
As I now use v. 5.1 of Cells, I amended the code to use the SheetRenderer class.
It works fine, except for the image file produced is far bigger than the range specified (see attached).
I assume that I have missed some ImageOrPrintOption setting somewhere....
Any help would be appreciated.
Steve
After playing, I found the following code works:
Dim options As New Rendering.ImageOrPrintOptions
options.ImageFormat = Imaging.ImageFormat.Png
options.IsImageFitToPage = True
options.PrintingPage = PrintingPageType.IgnoreBlank
options.IsCellAutoFit = True
options.OnePagePerSheet = True
but not sure which line in particular helped :)
Hi,
options.IsImageFitTopage = true
is the line segment when set to true indicates that the page only include the cells that have data. It acctually worked for you.
Regards,