Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How can I convert Emf file to Excel by code in C#?
Sergey Alexandrovich Kryukov 7-Apr-11 7:12am    
Please stop using the term "convert"! Some common illness in Inquirers.
You need to specify what you need: a mapping between .EMF objects and spreadsheet.
Toli Cuturicu 7-Apr-11 10:54am    
Absurdity. Have my 1.
Sergey Alexandrovich Kryukov 7-Apr-11 15:12pm    
Toli, I agree. My answer actually uses the method "Reductio ad absurdum". The method itself is fully logical, hope my Answer too. How do you think?
Toli Cuturicu 7-Apr-11 16:11pm    
The only vote of 5 of your answer is / was mine.
Sergey Alexandrovich Kryukov 7-Apr-11 16:59pm    
I'm not surprised. Thank you, Toli.

1 solution

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:[^].

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?)

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900