views:

84

answers:

0

Let's say I have an API which lets clients insert a file into a DOCX template, they just pass a path to the file. If it's an image I just want to add an image to the file, if it's something life RTF/DOC then I can maybe embed it so the content is visible, if it's some other type like MP3 or PDF then it might simply embed with an icon.

I guess I could simply look at file extension, but even then I think I might need the correct file-type string, I see code snippets like mainPart.AddEmbeddedObjectPart("application/vnd.openxmlformats-officedocument.oleObject") and wonder how I can map file-extension to type. Is there a handy page with such things?

And, I assume I do need different logic for pictures/other types? It would be weird to embed a picture?