| | |
Error opening word file from Asp.net
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 3
Reputation:
Solved Threads: 0
I am trying to opening Word file in asp.net application. I Try Following Code For That
All this works fine in View In Browser, But when I publish that Page The file
not opening and on Click of Button, Browser running continuosly, but cant find file. Is this error with path or else?
ASP.NET Syntax (Toggle Plain Text)
private Word.ApplicationClass WordApp = new Word.ApplicationClass(); protected void Button1_Click(object sender, EventArgs e) { Installation.doc"; object fileName = Server.MapPath("/WordSample/WordFiles/Test.doc"); object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; WordApp.Visible = true; Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,ref missing,ref missing,ref missing,ref missing); aDoc.Activate(); WordApp.Selection.TypeText("Copyright C# Corner"); WordApp.Selection.TypeParagraph(); }
All this works fine in View In Browser, But when I publish that Page The file
not opening and on Click of Button, Browser running continuosly, but cant find file. Is this error with path or else?
•
•
Join Date: Apr 2008
Posts: 114
Reputation:
Solved Threads: 6
change this line
to
ASP.NET Syntax (Toggle Plain Text)
object fileName = Server.MapPath("/WordSample/WordFiles/Test.doc");
ASP.NET Syntax (Toggle Plain Text)
object fileName = Server.MapPath("~") & "WordSample\WordFiles\Test.doc";
Please mark this post as 'Solved' if it has helped and fixed your issue.
TRY WITH BELOW LINE:
ASP.NET Syntax (Toggle Plain Text)
object fileName = Server.MapPath("WordFiles") + "\\" + "Test.doc";
MARK AS SOLVED if its help you.
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
TRY TO WRITE THE VALUE OF
Server.MapPath("WordFiles") then check with path then print whole file path then check with server. MARK AS SOLVED if its help you.
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
![]() |
Similar Threads
- Cannot find server or DNS Error - please help! (Viruses, Spyware and other Nasties)
- Open In New Window Php (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Hosting problem
- Next Thread: Using Checkbox in Data List
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu dynamically edit expose fill flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery listbox login menu microsoft mono mouse mssql multistepregistration news numerical objects opera order panelmasterpagebuttoncontrols radio ratings registration reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





