Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To convert a worksheet to an image using Aspose.Cells for Java in Ruby, simply invoke the Converter module.
Ruby Code
def worksheet_to_image(workbook)
# Create an object for ImageOptions
img_options = Rjb::import('com.aspose.cells.ImageOrPrintOptions').new
# Set the image type
image_format = Rjb::import('com.aspose.cells.ImageFormat')
img_options.setImageFormat(image_format.getPng())
# Get the first worksheet.
sheet = workbook.getWorksheets().get(0)
# Create a SheetRender object for the target sheet
sr = Rjb::import('com.aspose.cells.SheetRender').new(sheet, img_options)
j = 0
while j < sr.getPageCount()
# Generate an image for the worksheet
sr.toImage(j, @data_dir + "mysheetimg_#{j}.png")
j += 1
end
puts "Image saved successfully."
endDownload Converting Worksheet to Image (Aspose.Cells) from any of the social coding sites mentioned below:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.