Converting Worksheet to SVG in Ruby

Aspose.Cells - Converting Worksheet to SVG

To convert a worksheet to SVG using Aspose.Cells for Java in Ruby, simply invoke the worksheet_to_svg() method of the Converter module.

Ruby Code

 def worksheet_to_svg(workbook)

    # Convert each worksheet into SVG format in a single page.

    img_options = Rjb::import('com.aspose.cells.ImageOrPrintOptions').new

    save_format = Rjb::import('com.aspose.cells.SaveFormat')

    img_options.setSaveFormat(save_format.SVG)

    img_options.setOnePagePerSheet(true)



    # Convert each worksheet into SVG format

    sheet_count = workbook.getWorksheets().getCount()

    i=0

    while i < sheet_count

        sheet = workbook.getWorksheets().get(i)

        sr = Rjb::import('com.aspose.cells.SheetRender').new(sheet, img_options)

        k=0

        while sr.getPageCount()

            # Output the worksheet into SVG image format

            sr.toImage(k, @data_dir + sheet.getName() + "#{k}.svg")

        end

    end

    puts "SVG saved successfully."

end 

Download the Running Code

Download Converting Worksheet to SVG (Aspose.Cells) from any of the below‑mentioned social coding sites: