locked
HELP pleae on Office Interop for ASP.NET deployment RRS feed

  • Question

  • User1266736465 posted

    I have an ASP.NET that opens the MS-WORD document and save it as PDF it works greats within the visual studio IDE and my local environement.

    My Questions is
    Does MS-Office needs to be installed on ASP.NET hosted server in order for the Microsoft.Office.Interop.Word; to work after deployed?

    Thanks

    Saturday, November 10, 2018 3:05 PM

Answers

  • User475983607 posted

    I have an ASP.NET that opens the MS-WORD document and save it as PDF it works greats within the visual studio IDE and my local environement.

    My Questions is
    Does MS-Office needs to be installed on ASP.NET hosted server in order for the Microsoft.Office.Interop.Word; to work after deployed?

    Yes, MS Office must be installed on the server.  Microsoft does not recommend or support Office InterOp in Web Server applications as the site can become unstable.

    Consider using one of the many Open XML or one of the many NuGet PDF APIs.

    https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:15 PM
  • User1266736465 posted

    Thank you so much for your straight answer, I thought so too that MS-Office needed to be installed on server, but I was not sure.

    and regarding using the Open XML SDK I never used it and I do not have a clue on HOW TO that would be a learning process.
    Would it be possible that you provide a sample code on how to convert a word document to PDF, that is all I need, that would gives me a head start understanding the Open XML SDK, the word document will be already create and available, it just needs to be exported or converted to .PDF format.

    Thanks again for you all your help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:42 PM

All replies

  • User475983607 posted

    I have an ASP.NET that opens the MS-WORD document and save it as PDF it works greats within the visual studio IDE and my local environement.

    My Questions is
    Does MS-Office needs to be installed on ASP.NET hosted server in order for the Microsoft.Office.Interop.Word; to work after deployed?

    Yes, MS Office must be installed on the server.  Microsoft does not recommend or support Office InterOp in Web Server applications as the site can become unstable.

    Consider using one of the many Open XML or one of the many NuGet PDF APIs.

    https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:15 PM
  • User1266736465 posted

    Thank you so much for your straight answer, I thought so too that MS-Office needed to be installed on server, but I was not sure.

    and regarding using the Open XML SDK I never used it and I do not have a clue on HOW TO that would be a learning process.
    Would it be possible that you provide a sample code on how to convert a word document to PDF, that is all I need, that would gives me a head start understanding the Open XML SDK, the word document will be already create and available, it just needs to be exported or converted to .PDF format.

    Thanks again for you all your help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:42 PM
  • User409696431 posted

    There are third party tools that will convert a Word document to a PDF on the server.  You might look at those for a quicker solution.  Many are paid, but you could also try this one https://nugetmusthaves.com/Package/FreeSpire.Doc which is free.

    Sunday, November 11, 2018 2:42 AM
  • User876561910 posted

    You don't need MS Office on the server - just on the machine which will open it.

    Add your word doc to your site and then link to it.

    That's it.

    Sunday, November 11, 2018 7:23 AM
  • User409696431 posted

    "Add your word doc to your site and then link to it."

    You appeared to have misunderstood the question.  It was about converting a Word document to a PDF, not about downloading a Word document to the site visitor.

    Sunday, November 11, 2018 7:35 AM
  • User61956409 posted

    Hi msdevm,

    As mgebhard mentioned, installing MS Office on the server is not recommended.

    If possible, you can try other approaches, such as Aspose.Words for .NET. Or free Free Spire.Doc for .NET that KathyW shared.

    With Regards,

    Fei Han

    Tuesday, November 13, 2018 8:17 AM