将SVG图像导出到Excel [英] Export SVG image into Excel

查看:1653
本文介绍了将SVG图像导出到Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想将我网页上创建的SVG图像导出到Excel中。

我正在使用MVC4架构和剃刀网页。

场景:

我在网页上有一个网格和一个SVG图表。

我能够将图表数据导入Excel文件。

请给我关于如何将SVG图表导入Excel的建议?



谢谢,

Sharath

Hello,

I want to Export the SVG Image Created on my web page into Excel.
I am using MVC4 architecture and razor web pages.
Scenario:
I have a grid and a SVG chart in the web page.
I could able to import the chart data into the Excel file.
Please give me suggestions about how to import the SVG chart to Excel?

Thank You,
Sharath

推荐答案

通过VBA界面将此宏复制并粘贴到模块中:

Copy and paste this macro into module through VBA interface:
Sub svgImport()
'
' svgImport Macro
' importing .svg via fixed width text from .svg usg Import dialog in XL
'
' sn.svg is svg file
'
' svgImport.xls is target XL spreadsheet
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\SN\svgImport\sn.svg" _
        , Destination:=Range("


A


1 ))
.Name =snsvg
.FieldNames = True
.RowNumbers = False
.FillAdjac entFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:= False

结束ChDirC:\ usersrs \ nn \ svgImport
ActiveWorkbook.SaveAs Filena me:= _
C:\users\sn\svgImport\svgImport.xls,FileFormat:= _
xlExcel8,密码:=,WriteResPassword:=,ReadOnlyRecommended := False _
,CreateBackup:= False
列(A:A)。ColumnWidth = 147.6
End Sub
1")) .Name = "snsvg" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 437 .TextFileStartRow = 1 .TextFileParseType = xlFixedWidth .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileColumnDataTypes = Array(2) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With ChDir "C:\users\sn\svgImport" ActiveWorkbook.SaveAs Filename:= _ "C:\users\sn\svgImport\svgImport.xls", FileFormat:= _ xlExcel8, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False Columns("A:A").ColumnWidth = 147.6 End Sub



当然,Excel 2007不会解释.svg,因此不会将任何内容嵌入到图像中。在运行时输入的固定宽度文本性质没有包装,所以运气不会发生截断。巨大的.svg文件可能是另一回事。


Excel 2007 doesn't interpret .svg, of course, so nothing gets embedded as an image. The fixed-width text nature of the input at runtime does no wrapping so with any luck no truncation will occur. Huge .svg files might be another matter.


这篇关于将SVG图像导出到Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆