Creating and saving word doc on server

I have this web application in C # .net running on an external web server. In this, I am trying to create and save the word doc on the server (without opening it). It runs fines on my local computer, since I have a word installed on my machine, but on the server it shows an error when using the MyApplication class. I understand that it is impossible to set the word on the server. Right now I'm referencing the word.interopp assembly in my application. Is there a better way to solve the problem.

Thank you and welcome

Vicki J.

+3
source share
7 answers

If you try to use Office Interop without installing an office on the server, then it obviously will not work.

Word - - ?

, , Word, .

? ? RTF?

+3

Aspose.Word. Word Word .

+3

word.interop . , , WINWORD . , , , word.interop. , , Word 2007, , Word. , :)

+2

, - . .

protected void btnCreateWordBulletin_Click(object sender, EventArgs e)
{
String a= Server.MapPath("/Solution/Templates/Sport/Sport.doc"); 
String b= Server.MapPath("/Solution/Templates/Sport/SportSave.doc"); 
CreateWordDocument(a, b); 
}

protected void CreateWordDocument(object fileName, object saveAs)
{
    //Set Missing Value parameter - used to represent
    //a missing value when calling methods through interop
    object missing = System.Reflection.Missing.Value;
//Setup the Word.App class
Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document aDoc = null;
// Check to see that file exists
if (System.IO.File.Exists((string)fileName))
{... Activating doc etc...}}
+2

, Word . , winword.exe -, , winword.exe ASPNET. MS , Word . , ASPNET " ", ASPNET, Word , , ASPNET . winword (: , ), .

: winword . , MS , . winword ... .

+1

OfficeWriter - , DOC DOCX ( RTF ):

http://www.officewriter.com

0

OpenXML, . ( Office) . http://openxmldeveloper.org/

0

Source: https://habr.com/ru/post/1714955/


All Articles