spire.xls 支持将excel工作簿换到svg文件格式。本文将详细介绍如何将excel文档转换为svg格式。
原文档截图:
全部代码:
c#
//创建workbook对象
workbook workbook = new workbook();
//加载文件
workbook.loadfromfile(@"tosvgsample.xlsx");
for (int i = 0; i < workbook.worksheets.count; i )
{
filestream fs = new filestream(string.format("result{0}.svg", i), filemode.create);
//转换到svg
workbook.worksheets[i].tosvgstream(fs, 0, 0, 0, 0);
fs.flush();
fs.close();
}
vb.net
'创建workbook对象
dim workbook as new workbook()
'加载文件
workbook.loadfromfile("tosvgsample.xlsx")
for i as integer = 0 to workbook.worksheets.count - 1
dim fs as new filestream(string.format("result{0}.svg", i), filemode.create)
'转换到svg
workbook.worksheets(i).tosvgstream(fs, 0, 0, 0, 0)
fs.flush()
fs.close()
next
结果文件截图: