在Ruby中将工作表转换为SVG
Contents
[
Hide
]
Aspose.Cells - 将工作表转换为SVG
使用Ruby中的Aspose.Cells for Java将工作表转换为SVG,只需调用Converter模块的worksheet_to_svg()方法。
Ruby 代码
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
下载运行代码
从以下任何社交编码网站下载将工作表转换为SVG(Aspose.Cells):