| | |
Error opening word file from Asp.net
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
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: 115
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
Views: 915 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





