在C#中将.Emf文件转换为Excel [英] Covert .Emf file to Excel in C#

查看:128
本文介绍了在C#中将.Emf文件转换为Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过C#中的代码将Emf文件转换为Excel?

How can I convert Emf file to Excel by code in C#?

推荐答案

缺少一个部分:规范EMF和电子表格之间的映射.它在哪里?

其他一切都是可以解决的.您可以使用类System.Drawing.Imaging.Metafile访问元文件,可通过Microsoft Office工具箱访问Excel编程: http://msdn.microsoft.com/en-us/library/d2tx7z6d.aspx [ ^ ].

图元文件是矢量图形基元的集合.它们以某种顺序存储在图元文件中-这些对象在图元文件上绘制的顺序.该列表是多态的;它包含几种不同类型的原语.对象的一种相关类型是字符串.可以从图元文件中提取这些字符串,并将其放在电子表格单元格中.替代地/附加地,每个对象上的一些元数据和/或数字数据可以被呈现为某些电子表格类型的数据,并使用某些映射规则放置在单元格中.而已.我认为没有其他任何意义. (坦率地说,在电子表格上写那些对象几乎没有任何意义.也许我错过了一些东西:-))

现在,定义图元文件对象和电子表格之间的映射,然后开始工作!

(老实说,谁需要这个?)

—SA
There is one missing part: specification of the mapping between EMF and the spreadsheet. Where is it?

Everything else is solvable. You can access metafile using the class System.Drawing.Imaging.Metafile, Programming Excel is accessible through Microsoft Office toolkit: http://msdn.microsoft.com/en-us/library/d2tx7z6d.aspx[^].

A metafile is a collection of vector graphical primitives. They are stored in the meta-file in some sequence — the order in which these objects were drawn on a metafile. The list is polymorphous; it contains primitives of several different types. One relevant type of objects are strings. Those strings can be extracted from the metafile and placed in the spreadsheet cells. Alternatively/additionally, some meta-data and/or numerical data on each object can be presented as some spreadsheet type data and placed in the cells using certain mapping rules. That''s it. I don''t think anything else may make any sense. (And frankly, writing those objects on the spreadsheet hardly can make any sense. Maybe I''m missing something :-))

Now, define the mapping between the metafile objects and the spreadsheet and — get to work!

(Honestly, who needs this, ever?)

—SA


这篇关于在C#中将.Emf文件转换为Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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