can u plz tell me how to validate the given file is word document or not in c#. when i tried one sample say 1.pdf is renamed to 1.doc and tried to open it in c# using word 2007. it fails and it takes time to come out.
to avoide this time waste i want to detect the actual file type.
i am using word 2007 with c#2008. if the solution exist in word 2010 with c#2010 then also help full.
please provide me the solution i must need it also using atalasoft 10.0 and acrobat XI pro.
It’s not easy to detect the real type of a file. I recently needed a way to detect in ASP.NET if an uploaded file was an
.exe. I’ve added a methodIsWordfor you:However, note that all Office 2007 file formats ending in “x” are zip compressed XML documents. So this approach is not 100% safe but at least it might help you to filter out some invalid.