c# - How took Com objects that are in WCF project to the server -


i published wcf service server working locally in server getting error:

 retrieving com class factory component clsid. 

the job of service adding fields word template , convert pdf. guess can not find com object in server. 1 of object reference in project

microsoft.office.interop.word 

i have added reference project should install object in server?

microsoft.office.interop.word not designed to run in non interactive session (for example in self hosted service or iis, 2 ways host wcf on server). if code run going start running in other issues listed in above link.

you need switch open xml sdk able manipulate word documents in server setting.

edit: while not directly related see this old question of mine making same mistake (using word automation text replace inside sharepoint web service). in answer posted own question have example code of how replace text using open xml sdk.

using (wordprocessingdocument template = wordprocessingdocument.open(documentstream, true)) {     template.changedocumenttype(documentformat.openxml.wordprocessingdocumenttype.document);     maindocumentpart mainpart = template.maindocumentpart;     mainpart.documentsettingspart.addexternalrelationship(         "http://schemas.openxmlformats.org/officedocument/2006/relationships/attachedtemplate",         new uri(templetaddr, urikind.absolute));      replacetext(mainpart, "#practicename#", practicename);     if(!string.isnullorempty(educationdate))         replacetext(mainpart, "#educationdate#", educationdate);     if(!string.isnullorempty(maincontactinfo))         replacetext(mainpart, "#maincontactinfo#", maincontactinfo);     if(!string.isnullorempty(address))         replacetext(mainpart, "#address#", address); } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -