Solved

ASP.net VB.net upload Word doc to site

Posted on 2013-06-03
5
417 Views
Last Modified: 2013-06-05
Hi

Is it possible to post upload a Word document to an ASP.net site so that
the rich text format in the Word doc can be displayed on the site?
If not is there another way to type formatted text similar to that held in a Word doc
so that it may be used on an ASP.net Website?
0
Comment
Question by:murbro
5 Comments
 
LVL 16

Assisted Solution

by:Kamal Khaleefa
Kamal Khaleefa earned 125 total points
ID: 39218070
you need to display the content of the uploaded file right?

in this case you have to create a function that access your file and read its content but it will not come in formatted way

you can control the style by creating CSS class and put all the attributes you need
0
 

Author Comment

by:murbro
ID: 39218830
Hi

Thanks

Would you know of an example of the code that would you would use for this?

Thanks
0
 
LVL 23

Assisted Solution

by:Roopesh Reddy
Roopesh Reddy earned 125 total points
ID: 39223053
Hi,

Check this article - http://roopeshreddy.wordpress.com/tag/view-uploaded-file/

Again you may have to build Online Viewer Google Docs or Office 365, which is bit complex!

Hope it helps u...
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 250 total points
ID: 39224110
With the following interface
<div>Upload your file</div>
<asp:FileUpload ID="fuWordFile" runat="server"></asp:FileUpload>
<asp:Button ID="cmdUpload" runat="server" Text="Upload" OnClick="cmdUpload_Click" />

Open in new window

I would save the file and then convert it to a single page web site using Word, add a reference to Microsoft Word X.X Object Library (X.X) is the version and using this code:
fuWordFile.SaveAs(Server.MapPath("~/files/" + Path.GetFileName(fuWordFile.FileName)));
//Save Word as web
ApplicationClass wordApp = new ApplicationClass();
wordApp.Documents.Open(Server.MapPath("~/files/" + Path.GetFileName(fuWordFile.FileName)));
wordApp.ActiveDocument.SaveAs2(Server.MapPath("~/web/" + Path.GetFileNameWithoutExtension(fuWordFile.FileName) + ".mht"),
    9);

Response.Redirect("~/web/" + Path.GetFileNameWithoutExtension(fuWordFile.FileName) + ".mht", false);

wordApp.Quit(false);

Open in new window

Well, you must first create "files" and "web" folders.
0
 

Author Closing Comment

by:murbro
ID: 39224692
Thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
crm development 2 68
ASP.NET Web Form Variables being reset 2 26
ASP.NET reading ATOM 2 52
Server Error 11 47
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now