Solved

ASP.net VB.net upload Word doc to site

Posted on 2013-06-03
5
415 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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