c# - Convert Selected PowerPoint Shapes (or DrawingML) to XAML -


i need convert selected powerpoint shapes xaml can place equivalent vector-based shape inside wpf app (the xaml end result has scalable - converting image defeats purpose of i'm trying do).

i'm open variety of ways accomplish this, including writing powerpoint addin (if me access bezier point coordinates of selected shapes in powerpoint). i'm not familiar enough powerpoint addins know if possible or not.

my first approach copy powerpoint shapes clipboard, , convert clipboard contents objects can understand , generate xaml there. if can drawingml representation (through art::gvml clipformat), it's unclear how convert drawingml xaml (looks weeks of error-prone work create scratch).

there other formats available on clipboard (emf, system.drawing.imaging.metafile, powerpoint 12.0 internal shapes), appear dead ends.

any suggestions?

you can try this:

powerpoint shape wmf

microsoft.office.interop.powerpoint.application app = new microsoft.office.interop.powerpoint.application(); var pps = app.presentations; string d ="filepath.pptx"; presentation ppt = pps.open(d, msotristate.msofalse, msotristate.msofalse, msotristate.msofalse); (int j = 1; j < ppt.slides.count; j++) {     slide sld = ppt.slides[j];     list<microsoft.office.interop.powerpoint.shape> shapes = new list<microsoft.office.interop.powerpoint.shape>();     (int k = 1; k < sld.shapes.count; k++)     {         microsoft.office.interop.powerpoint.shape shape = sld.shapes[k];          shape.export("outputfilepath.wmf", ppshapeformat.ppshapeformatwmf);     } } 

then wmf xaml: microsoft forum:

1) check out http://www.wpf-graphics.com/readerwmf.aspx , it's related project http://www.wpf-graphics.com/paste2xaml.aspx. these emf/wmf readers wpf. you'd write simple utility read in images , write them out again. i've played them little , had pretty luck them. if they'll work you, first choice. you'll need test them of course. conversions never perfect due difference in design between various formats make sure you're not using that's not supported in converter.

2) project ran http://lab.aspitalia.com/15/emftoxaml-beta.aspx. haven't played it, might give look.

3) if direct route doesn't work, might consider converting wmf files different vector format svg , converting svg file xaml. there lots of tools emf/wmf svg conversion. svg xaml conversion can @ http://www.codeplex.com/xamltune , http://www.wpf-graphics.com/readersvg.aspx. doubt work direct conversion, never know.

about powerpoint add-ins , running above example need microsoft office interop libraries.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -