-2

Is it possible to read and open files through c# without MS Office installed. I have a site hosted in godaddy that particular code which reads word Works locally but not in live site. This is the m,ethod that im using to read the content of the uploaded file (both doc or docx) but its not working in GoDaddy

public static string ReadResume(string path)
        {
            try
            {
                string contentOfResume = string.Empty;
                Application application = new Application();
                Document doc = application.Documents.Open(path, Type.Missing, true);
                application.Selection.WholeStory();
                application.Selection.Copy();
                contentOfResume = application.Selection.Range.Text;
                application.Quit(false, false, false);
                return contentOfResume;
            }
        }

I have tried

NetOffice

But it didnt worked as i noticed that internally it uses word interop and they mentioned it is not a replacement.

So I would like to know if there are any Free C# Libraries available.

6
  • 1
    Which version of MS Office files? If they are docx maybe you can just unzip them and go for the internal xml directly. en.wikipedia.org/wiki/Office_Open_XML_file_formats
    – Juan
    Mar 26, 2015 at 11:09
  • Both doc and Docx files
    – Vivekh
    Mar 26, 2015 at 11:12
  • 2
    You are not very specific about the scenario. E.g. " that particular code which reads word Works locally but not in live site" doesn't make sense. I understand that you are probably not a native speaker. Try to use short, simple sentences, provide technical information (which usually is pretty language indifferent) and, best, provide code samples. Code is a language which we all understand here. Mar 26, 2015 at 11:22
  • Thanks for enlightening. +1 Edited
    – Vivekh
    Mar 26, 2015 at 11:44
  • Does Open XML requires Office to be installed ?
    – Vivekh
    Mar 26, 2015 at 13:46

2 Answers 2

0

Depends and what you need from the file, you can unzip and parse the XML. I have seen that done before with some success.

This is free but limited to so many pages / paras

http://www.e-iceblue.com/Introduce/free-doc-component.html

Also, hunt around for WORD -> HTML tools.

0

OpenOffice reads, manipulates and writes MS Office documents and can be automated. Cf. https://www.openoffice.org/udk/common/man/tutorial/office_automation.html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.