Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Word
I want server(IIS) to ceate a word doument and users can download this file BY ie.
 
i use the solutions of MS WORD AUTOMATIONS,the codes like below:
 
using Word = Microsoft.Office.Interop.Word;
private Word.ApplicationClass oWordApplic;
private Word.Document oDoc;		
 
oWordApplic = new Word.ApplicationClass();
object missing = System.Reflection.Missing.Value;
oDoc = oWordApplic.Documents.Add(ref missing, ref missing,ref missing, ref missing);
oDoc.Activate();		
oWordApplic.Selection.TypeText("test");
oDoc.SaveAs("tes.doc", ref missing,ref missing, ref missing,ref missing,ref missing,ref missing,
				ref missing,ref missing,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
 
oWordApplic.Application.Quit(ref missing, ref missing, ref missing);
 

 
this codes works well on my local machine,but when i publish this asp.net project on the server, the code do not work AND there is no any prompt message or error message.
 
no file is created and no any alert message.
 
anyone can help me??
 

 

 

I find the cause of this problem!

 
in the web.config, if i set the (release), the issue occurs

if I set the (debug), the programs works well.

but I do not know why? and I publish a debug version to the server ?

anyone can help me ???
Posted 3-Mar-13 16:05pm
Edited 4-Mar-13 3:13am
v3
Comments
David_Wimbley at 3-Mar-13 23:18pm
   
Stupid question, is word installed on the server running asp.net?
Raja Soosai at 4-Mar-13 1:54am
   
Provide proper permission to IIS to interact with COM Objects.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

thanks for your help!
 
I find the cause of this problem!
 

in the web.config, if i set the (release), the issue occurs
 
if I set the (debug), the programs works well.
 
but I do not know why? and I publish a debug version to the server ?
 
anyone can help me ???
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

What you have written will run on server. Check if the file is created on server and placed in the folder where you wrote code for.
Since you are having a web application, user/client will not see anything on their side - error or prompt as the code written is not a client side.
 
Code above is to create a word document and save on server. Now, your steps should be to find the core issue:
1. Document created or not
2. Document downloaded to client or not
 
Check for 1 first, if there is any issue on creation, it should be captured by logs. May be insufficient security privilege to save a file in the folder designated.
If 1 is working fine, look at the code for 2. See if the file is picked from correct location to be passed to client or not. Go step wise and narrow down the issue to resolve. May be the filepath while picking for download is not correctly formed.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Afzaal Ahmad Zeeshan 82
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100