NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
697 stars 143 forks source link

Does NetOffice depend MS Office? #315

Closed JohnnyZhang0628 closed 3 years ago

JohnnyZhang0628 commented 3 years ago

Hello,I test it on Win7 that it not install MS Office ,it not work .So i not sure NetOffice depend MS Office?

jozefizso commented 3 years ago

Yes, NetOffice requires the Microsoft Office to be installed on the machine where you use these libraries.

JohnnyZhang0628 commented 3 years ago

I install MS Office 2007, it throw an exception . image this is my code:

 using (var word = new Application())
            {
                Document document = null;
                try
                {
                    document = word.Documents.Open(Path.Combine(Directory.GetCurrentDirectory(), "111.doc"));
                    document.ExportAsFixedFormat(Path.Combine(Directory.GetCurrentDirectory(), "222.pdf"), NetOffice.WordApi.Enums.WdExportFormat.wdExportFormatPDF);
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Message:{e.Message},InnerException.Message:{ e.InnerException.Message}");
                }
                finally
                {
                    document.Close(false);
                    word.Quit();
                }
            }

            Console.WriteLine("done");
            Console.ReadKey();

OS:win7

NetOffice Version:1.8.1

MS Office:2007