473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

exporting html web form to the word document file

hi all,
my web page is created for application form for inserting details by the student's... actually i want to add a option that the user can download my page to word file and make a hard copy of my application.. can i get the code or example for downloading my page into a word file...

thanks..
Jan 23 '09 #1
1 3831
PRR
750 Expert 512MB
@satyabhaskar
Assuming you are generating a .doc file on your server...
Expand|Select|Wrap|Line Numbers
  1. [IMG]file:///C:/DOCUME%7E1/admin/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG]On button click
  2. string myFile = @"~\1.doc";
  3. string filePath = Server.MapPath(myFile);
  4.  
  5. System.IO.FileInfo file = new System.IO.FileInfo(filePath);
  6.  
  7.             if (file.Exists)
  8.             {
  9. Response.ContentType = "application/ms-word";
  10.                     Response.AddHeader("content-disposition", "attachment; filename=" + file.Name);
  11.                     byte[] bytes;
  12.  
  13.                     using (FileStream fStream = new FileStream(filePath, FileMode.Open))
  14.                     {
  15.                         long size;
  16.                         size = fStream.Length;
  17.                         bytes = new byte[(int)size];
  18.                         fStream.Read(bytes, 0, (int)fStream.Length);
  19.                         fStream.Close();
  20.                     }
  21.         }
  22. [IMG]file:///C:/DOCUME%7E1/admin/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]
  23.  
How to automate Microsoft Word to create a new document by using Visual C#
Jan 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Holger Butschek | last post by:
Hi folks, first of all, I'm absolutly new to javascript. I have designed a html-form and am trying to path parameters with the suffix of i.e. ?Seminartitel=hallowelt in the url. In the head...
5
by: Jayjay | last post by:
Is it possible to export a report to word and have it include the graphics that are in the report? I'd like to take some of our reports and export them to word so we can email those to the...
4
by: Lisa | last post by:
Hello, I have an ole object in my database that contains mostly pictures. I have this field in a report that I need to export to MS Word. When I export the report, I get everything accept the...
3
by: Paolo | last post by:
Friends, I have a problem with my Access database when trying to export data from a form to a Word file. I use a form to store data in a table. Both table and form are named CONTACT. I use a...
4
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can...
0
by: Otis Hunter | last post by:
I have been fighting with this for days and your expert help is needed! Below is the code I am executing which results with "Object doesn't support this property or method". The error is occuring...
2
by: Yaseen D M | last post by:
I have aspx page which contains some gif, jpg and png images. PNG image is generated dynamically. This file is basically a graph image. The problem i am facing in exporting these images to word,...
2
by: Mux | last post by:
I am facing the following problem while exporting data to Word. The current implementation is as described below: I have a JSP file which has a link that enables you to export the data to Word....
4
by: no8do | last post by:
Hi there, I am brand new in access and VBA programming and I am asking for your help. One of the fields in my db is of the OLE object data-type. I' ve written a vb script that is executed on a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.