Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Creating Word documents on page

Reply
Thread Tools

Creating Word documents on page

 
 
enak
Guest
Posts: n/a
 
      10-24-2003
I have found some code that shows how to convert an html
form to Word. The message said to simply put the following
in the Page_load:

Response.ContentType = "application/ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")

Now all I should have to do is create the page just like I
would if I were going to display it in the browser.

I create the document in the browser using code similar to
the following:


Response.Write("<table width=""100%"">")
Response.Write(" <tr height=1><td align=right><img
src=""images\bp_white2_icon.ico""></tr>")
Response.Write(" <tr><td align=center><font size=+3>My
Report</font></tr>")
Response.Write(" <tr><td align=center><font size=+3>BP
Cases Status Report</font></tr>")

'==============================================
'MAIN TABLE
'==============================================
Response.Write(" <tr><td>")
Response.Write(" <table border=0 width=""100%""
cellspacing=3 cellpadding=0>")
Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
Plaintiff<td>Jurisdiction<td>Court<td>In-House
Counsel<td># of Pltfs<td>Status<td>BP Billing
Breakdown</tr>")
Response.Write(" </table>")
Response.Write(" </tr>")
'==============================================
'MAIN TABLE
'==============================================
Response.Write("</table>")


The page loads fine until I try to load it as a Word
document. I know that someone out there has done this.

Can anyone help?

Thanks
enak




 
Reply With Quote
 
 
 
 
Ivan
Guest
Posts: n/a
 
      10-24-2003
What do you mean by "get fine until....". What eroor do
you get ?

and why do you use Response.Write ? Are you doing ASP.NET
or ASP ?



>-----Original Message-----
>I have found some code that shows how to convert an html
>form to Word. The message said to simply put the

following
>in the Page_load:
>
>Response.ContentType = "application/ms-word"
>Response.AddHeader("content-disposition", "inline;
>filename=BP_CaseStatus.doc")
>
>Now all I should have to do is create the page just like

I
>would if I were going to display it in the browser.
>
>I create the document in the browser using code similar

to
>the following:
>
>
>Response.Write("<table width=""100%"">")
>Response.Write(" <tr height=1><td align=right><img
>src=""images\bp_white2_icon.ico""></tr>")
>Response.Write(" <tr><td align=center><font size=+3>My
>Report</font></tr>")
>Response.Write(" <tr><td align=center><font size=+3>BP
>Cases Status Report</font></tr>")
>
>'==============================================
>'MAIN TABLE
>'==============================================
>Response.Write(" <tr><td>")
>Response.Write(" <table border=0 width=""100%""
>cellspacing=3 cellpadding=0>")
>Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>Plaintiff<td>Jurisdiction<td>Court<td>In-House
>Counsel<td># of Pltfs<td>Status<td>BP Billing
>Breakdown</tr>")
>Response.Write(" </table>")
>Response.Write(" </tr>")
>'==============================================
>'MAIN TABLE
>'==============================================
>Response.Write("</table>")
>
>
>The page loads fine until I try to load it as a Word
>document. I know that someone out there has done this.
>
>Can anyone help?
>
>Thanks
>enak
>
>
>
>
>.
>

 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      10-24-2003
Thanks for your response.

I am using asp.net. If I try to display the page with just
the HTML the page displays as I would expect.

However, if I add the following two lines the page is
blank:

Response.ContentType = "application/ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")

Currently, I am using HTML but should I be doing it
differently? Can I use a datagrid rather than <table>?

Thanks,
enak

>-----Original Message-----
>What do you mean by "get fine until....". What eroor do
>you get ?
>
>and why do you use Response.Write ? Are you doing ASP.NET
>or ASP ?
>
>
>
>>-----Original Message-----
>>I have found some code that shows how to convert an html
>>form to Word. The message said to simply put the

>following
>>in the Page_load:
>>
>>Response.ContentType = "application/ms-word"
>>Response.AddHeader("content-disposition", "inline;
>>filename=BP_CaseStatus.doc")
>>
>>Now all I should have to do is create the page just like

>I
>>would if I were going to display it in the browser.
>>
>>I create the document in the browser using code similar

>to
>>the following:
>>
>>
>>Response.Write("<table width=""100%"">")
>>Response.Write(" <tr height=1><td align=right><img
>>src=""images\bp_white2_icon.ico""></tr>")
>>Response.Write(" <tr><td align=center><font size=+3>My
>>Report</font></tr>")
>>Response.Write(" <tr><td align=center><font size=+3>BP
>>Cases Status Report</font></tr>")
>>
>>'============================================= =
>>'MAIN TABLE
>>'============================================= =
>>Response.Write(" <tr><td>")
>>Response.Write(" <table border=0 width=""100%""
>>cellspacing=3 cellpadding=0>")
>>Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>>Plaintiff<td>Jurisdiction<td>Court<td>In-House
>>Counsel<td># of Pltfs<td>Status<td>BP Billing
>>Breakdown</tr>")
>>Response.Write(" </table>")
>>Response.Write(" </tr>")
>>'============================================= =
>>'MAIN TABLE
>>'============================================= =
>>Response.Write("</table>")
>>
>>
>>The page loads fine until I try to load it as a Word
>>document. I know that someone out there has done this.
>>
>>Can anyone help?
>>
>>Thanks
>>enak
>>
>>
>>
>>
>>.
>>

>.
>

 
Reply With Quote
 
Ivan
Guest
Posts: n/a
 
      10-24-2003
I just tried your code and it works (not if you do this in
a page load. Only at a postback from an button_click event
for example).

This can work only if you have at least office 2000 and IE
5.5.
>-----Original Message-----
>Thanks for your response.
>
>I am using asp.net. If I try to display the page with

just
>the HTML the page displays as I would expect.
>
>However, if I add the following two lines the page is
>blank:
>
>Response.ContentType = "application/ms-word"
>Response.AddHeader("content-disposition", "inline;
>filename=BP_CaseStatus.doc")
>
>Currently, I am using HTML but should I be doing it
>differently? Can I use a datagrid rather than <table>?
>
>Thanks,
>enak
>
>>-----Original Message-----
>>What do you mean by "get fine until....". What eroor do
>>you get ?
>>
>>and why do you use Response.Write ? Are you doing

ASP.NET
>>or ASP ?
>>
>>
>>
>>>-----Original Message-----
>>>I have found some code that shows how to convert an

html
>>>form to Word. The message said to simply put the

>>following
>>>in the Page_load:
>>>
>>>Response.ContentType = "application/ms-word"
>>>Response.AddHeader("content-disposition", "inline;
>>>filename=BP_CaseStatus.doc")
>>>
>>>Now all I should have to do is create the page just

like
>>I
>>>would if I were going to display it in the browser.
>>>
>>>I create the document in the browser using code similar

>>to
>>>the following:
>>>
>>>
>>>Response.Write("<table width=""100%"">")
>>>Response.Write(" <tr height=1><td align=right><img
>>>src=""images\bp_white2_icon.ico""></tr>")
>>>Response.Write(" <tr><td align=center><font size=+3>My
>>>Report</font></tr>")
>>>Response.Write(" <tr><td align=center><font size=+3>BP
>>>Cases Status Report</font></tr>")
>>>
>>>'============================================ ==
>>>'MAIN TABLE
>>>'============================================ ==
>>>Response.Write(" <tr><td>")
>>>Response.Write(" <table border=0 width=""100%""
>>>cellspacing=3 cellpadding=0>")
>>>Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>>>Plaintiff<td>Jurisdiction<td>Court<td>In-House
>>>Counsel<td># of Pltfs<td>Status<td>BP Billing
>>>Breakdown</tr>")
>>>Response.Write(" </table>")
>>>Response.Write(" </tr>")
>>>'============================================ ==
>>>'MAIN TABLE
>>>'============================================ ==
>>>Response.Write("</table>")
>>>
>>>
>>>The page loads fine until I try to load it as a Word
>>>document. I know that someone out there has done this.
>>>
>>>Can anyone help?
>>>
>>>Thanks
>>>enak
>>>
>>>
>>>
>>>
>>>.
>>>

>>.
>>

>.
>

 
Reply With Quote
 
enak
Guest
Posts: n/a
 
      10-24-2003
I need this to work from the Page_Load. What I do is on
the Page_Load I call a sub that creates the page in HTML.
I have the two lines for the Word object in the Page_Load.

Do you know how I can make this work?

I have ie 5.5 and office 2000

>-----Original Message-----
>I just tried your code and it works (not if you do this

in
>a page load. Only at a postback from an button_click

event
>for example).
>
>This can work only if you have at least office 2000 and

IE
>5.5.
>>-----Original Message-----
>>Thanks for your response.
>>
>>I am using asp.net. If I try to display the page with

>just
>>the HTML the page displays as I would expect.
>>
>>However, if I add the following two lines the page is
>>blank:
>>
>>Response.ContentType = "application/ms-word"
>>Response.AddHeader("content-disposition", "inline;
>>filename=BP_CaseStatus.doc")
>>
>>Currently, I am using HTML but should I be doing it
>>differently? Can I use a datagrid rather than <table>?
>>
>>Thanks,
>>enak
>>
>>>-----Original Message-----
>>>What do you mean by "get fine until....". What eroor do
>>>you get ?
>>>
>>>and why do you use Response.Write ? Are you doing

>ASP.NET
>>>or ASP ?
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>I have found some code that shows how to convert an

>html
>>>>form to Word. The message said to simply put the
>>>following
>>>>in the Page_load:
>>>>
>>>>Response.ContentType = "application/ms-word"
>>>>Response.AddHeader("content-disposition", "inline;
>>>>filename=BP_CaseStatus.doc")
>>>>
>>>>Now all I should have to do is create the page just

>like
>>>I
>>>>would if I were going to display it in the browser.
>>>>
>>>>I create the document in the browser using code

similar
>>>to
>>>>the following:
>>>>
>>>>
>>>>Response.Write("<table width=""100%"">")
>>>>Response.Write(" <tr height=1><td align=right><img
>>>>src=""images\bp_white2_icon.ico""></tr>")
>>>>Response.Write(" <tr><td align=center><font size=+3>My
>>>>Report</font></tr>")
>>>>Response.Write(" <tr><td align=center><font size=+3>BP
>>>>Cases Status Report</font></tr>")
>>>>
>>>>'============================================= =
>>>>'MAIN TABLE
>>>>'============================================= =
>>>>Response.Write(" <tr><td>")
>>>>Response.Write(" <table border=0 width=""100%""
>>>>cellspacing=3 cellpadding=0>")
>>>>Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>>>>Plaintiff<td>Jurisdiction<td>Court<td>In-House
>>>>Counsel<td># of Pltfs<td>Status<td>BP Billing
>>>>Breakdown</tr>")
>>>>Response.Write(" </table>")
>>>>Response.Write(" </tr>")
>>>>'============================================= =
>>>>'MAIN TABLE
>>>>'============================================= =
>>>>Response.Write("</table>")
>>>>
>>>>
>>>>The page loads fine until I try to load it as a Word
>>>>document. I know that someone out there has done this.
>>>>
>>>>Can anyone help?
>>>>
>>>>Thanks
>>>>enak
>>>>
>>>>
>>>>
>>>>
>>>>.
>>>>
>>>.
>>>

>>.
>>

>.
>

 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-25-2003
Hi Enak,

Thank you for posting to the MSDN Managed newsgroups. We are acknowledging
your post and you should receive response from the community within 2
business days of your post.

If you have any concerns, please feel free to let us know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! 每 www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-26-2003
Hi Enak,

I am sorry if there is any misunderstanding.

As I understand, what you want is exporting data to MS word. I have found
some articles regarding how to Export data to Excel. I hope it helps.

Export to Excel
http://www.aspnetpro.com/NewsletterA..._l/asp200309so
_l.asp
"...
Use ASP.NET to send functionally rich reports to your users.
..."

HOW TO: Export Data in a DataGrid on an ASP . NET WebForm to Microsoft Excel
http://support.microsoft.com/default...b;en-us;317719

In addition, please upgrade to IE6 and test this issue again.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! 每 www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
enak
Guest
Posts: n/a
 
      10-27-2003
Jacob, thanks for doing the research.

My original post talked about something a little different.

I can create the page using HTML and tables. It displays
just fine but then I read on ASP.Net forum that once I
have done that all I need to do is add the following to
the Page_Load function and the HTML will be converted to
Word.

Response.ContentType = "application/vnd.ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")

This brings up a page that does not look anything like
mine. Do you have any experience with this?

Thanks
enak
>-----Original Message-----
>Hi Enak,
>
>I am sorry if there is any misunderstanding.
>
>As I understand, what you want is exporting data to MS

word. I have found
>some articles regarding how to Export data to Excel. I

hope it helps.
>
>Export to Excel
>http://www.aspnetpro.com/NewsletterA...003/09/asp2003

09so_l/asp200309so
>_l.asp
>"...
>Use ASP.NET to send functionally rich reports to your

users.
>..."
>
>HOW TO: Export Data in a DataGrid on an ASP . NET WebForm

to Microsoft Excel
>http://support.microsoft.com/default.aspx?scid=kb;en-

us;317719
>
>In addition, please upgrade to IE6 and test this issue

again.
>
>If I have misunderstood your concern, please feel free to

let me know.
>
>Best regards,
>
>Jacob Yang
>Microsoft Online Partner Support
>Get Secure! 每 www.microsoft.com/security
>This posting is provided "as is" with no warranties and

confers no rights.
>
>.
>

 
Reply With Quote
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-28-2003
Hi Enak,

Thank you for your update.

I have already tested your code on my side. Please try the following steps
on your side. (I am using Windows XP Pro/VS.NET 2003/IE 6)

1. Create a default web application.

2. Add the following code in Page_Load.

Response.Write("<table width=""100%"">")
Response.Write(" <tr><td align=center><font size=+3>My
Report</font></tr>")
Response.Write(" <tr><td align=center><font size=+3>BP Cases Status
Report</font></tr>")

'==============================================
'MAIN TABLE
'==============================================
Response.Write(" <tr><td>")
Response.Write(" <table border=0 width=""100%"" cellspacing=3
cellpadding=0>")
Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
Plaintiff<td>Jurisdiction<td>Court<td>In-House Counsel<td># of
Pltfs<td>Status<td>BP Billing Breakdown</tr>")
Response.Write(" </table>")
Response.Write(" </tr>")
'==============================================
'MAIN TABLE
'==============================================
Response.Write("</table>")

3. Build and Run the application.

4. We can see the table we creat.

5. Right click the page and select "View Source". We can see the following
HTML code.
----------------------------------------------
<table width="100%"> <tr><td align=center><font size=+3>My
Report</font></tr> <tr><td align=center><font size=+3>BP Cases Status
Report</font></tr> <tr><td> <table border=0 width="100%" cellspacing=3
cellpadding=0> <tr bgcolor=#bbbbbb><td>Lead
Plaintiff<td>Jurisdiction<td>Court<td>In-House Counsel<td># of
Pltfs<td>Status<td>BP Billing Breakdown</tr> </table> </tr></table>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtMTI3OTMzNDM4NDs7PkHVmr4UQqVvjWev6bWIe9o veFlT" />

<FONT face="Arial"></FONT>
</form>
</body>
</HTML>
----------------------------------------------

6. Then please add the following two statements in Page_Load.

Response.ContentType = "application/ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")

7. Build and run the application again. After click the "Open" button, we
can find that only the content between "<HTML>" and "</HTML>" are converted
to word. That is the reason of this issue.

8. Then please change the code in Page_Load as the following:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.ContentType = "application/ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")
End Sub

9. Change the HTML code of the web form as the following:
--------------------------------------------------------------------
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="TestWord.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="Arial"></FONT>
</form>
<table width="100%">
<tr>
<td align="center"><font size="+3">My Report</font></td>
<tr>
<td align="center"><font size="+3">BP Cases Status Report</font></td>
<tr>
<td>
<table border="0" width="100%" cellspacing="3" cellpadding="0">
<tr bgcolor="#bbbbbb">
<td>
Lead Plaintiff<td>
Jurisdiction<td>
Court<td>
In-House Counsel<td>
# of Pltfs<td>
Status<td>BP Billing Breakdown</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</HTML>
--------------------------------------------------------------------

10. Build and run the application. Now we can see the table in MS word.

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! 每 www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
enak
Guest
Posts: n/a
 
      10-28-2003
Thank you for clearing that up.

I see that you are creating the report in HTML and then
converting it to Word. However, I get all of the data for
the report from an SQL 2000 database. That is why I was
trying to do all of the coding from the code_behind page.

In order to continue to do this I have tried to write the
entire table to a string and pass that string to the aspx
page. This does not work. I am not getting the function
called when the form loads. Here is what I am doing:

<HTML>
<HEAD>
<title>WordForm</title>
<%
'Response.ContentType = "application/vnd.ms-word"
'Response.AddHeader("content-
disposition", "inline; filename=BP_CaseStatus.doc")
%>
<meta content="Microsoft Visual
Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1"
name="CODE_LANGUAGE">
<meta content="JavaScript"
name="vs_defaultClientScript">
<meta
content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<asp:Table Runat=server>
<asp:TableRow>
<asp:TableCell><%# getReportTable
() %></asp:TableCell>
</asp:TableRow>
</asp:Table>
</body>
</HTML>


CODE BEHIND

Public Function getReportTable() As String
Dim sUser As String = Mid(Page.User.Identity.Name,
InStr(Page.User.Identity.Name, "\") + 1)
Dim sPath As String =
Request.PhysicalApplicationPath 'gives the path where this
file exists

If Request.QueryString("report") = "Case Status
Report w/ BP Billing Data" Then
Return BPCaseStatusWithBillingData(sUser,
sPath)
End If

End Function

I have a breakpoint on the "If" statement but the debugger
never stops there. The function is never called.

Any ideas why?

Thanks
enak

>-----Original Message-----
>Hi Enak,
>
>Thank you for your update.
>
>I have already tested your code on my side. Please try

the following steps
>on your side. (I am using Windows XP Pro/VS.NET 2003/IE 6)
>
>1. Create a default web application.
>
>2. Add the following code in Page_Load.
>
> Response.Write("<table width=""100%"">")
> Response.Write(" <tr><td align=center><font

size=+3>My
>Report</font></tr>")
> Response.Write(" <tr><td align=center><font

size=+3>BP Cases Status
>Report</font></tr>")
>
> '==============================================
> 'MAIN TABLE
> '==============================================
> Response.Write(" <tr><td>")
> Response.Write(" <table border=0 width=""100%""

cellspacing=3
>cellpadding=0>")
> Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>Plaintiff<td>Jurisdiction<td>Court<td>In-House

Counsel<td># of
>Pltfs<td>Status<td>BP Billing Breakdown</tr>")
> Response.Write(" </table>")
> Response.Write(" </tr>")
> '==============================================
> 'MAIN TABLE
> '==============================================
> Response.Write("</table>")
>
>3. Build and Run the application.
>
>4. We can see the table we creat.
>
>5. Right click the page and select "View Source". We can

see the following
>HTML code.
>----------------------------------------------
><table width="100%"> <tr><td align=center><font

size=+3>My
>Report</font></tr> <tr><td align=center><font size=+3>BP

Cases Status
>Report</font></tr> <tr><td> <table border=0 width="100%"

cellspacing=3
>cellpadding=0> <tr bgcolor=#bbbbbb><td>Lead
>Plaintiff<td>Jurisdiction<td>Court<td>In-House

Counsel<td># of
>Pltfs<td>Status<td>BP Billing Breakdown</tr> </table>

</tr></table>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0

Transitional//EN">
><HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" content="Microsoft

Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" content="Visual

Basic .NET 7.1">
> <meta name="vs_defaultClientScript"

content="JavaScript">
> <meta name="vs_targetSchema"
>content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form name="Form1" method="post"

action="WebForm1.aspx" id="Form1">
><input type="hidden" name="__VIEWSTATE"
>value="dDwtMTI3OTMzNDM4NDs7PkHVmr4UQqVvjWev6bWIe9 oveFlT" /
>
>
> <FONT face="Arial"></FONT>
> </form>
> </body>
></HTML>
>----------------------------------------------
>
>6. Then please add the following two statements in

Page_Load.
>
>Response.ContentType = "application/ms-word"
>Response.AddHeader("content-disposition", "inline;
>filename=BP_CaseStatus.doc")
>
>7. Build and run the application again. After click

the "Open" button, we
>can find that only the content between "<HTML>"

and "</HTML>" are converted
>to word. That is the reason of this issue.
>
>8. Then please change the code in Page_Load as the

following:
>
> Private Sub Page_Load(ByVal sender As System.Object,

ByVal e As
>System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> Response.ContentType = "application/ms-word"
> Response.AddHeader("content-

disposition", "inline;
>filename=BP_CaseStatus.doc")
> End Sub
>
>9. Change the HTML code of the web form as the following:
>----------------------------------------------------------

----------
><%@ Page Language="vb" AutoEventWireup="false"
>Codebehind="WebForm1.aspx.vb"

Inherits="TestWord.WebForm1"%>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0

Transitional//EN">
><HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" content="Microsoft

Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" content="Visual

Basic .NET 7.1">
> <meta name="vs_defaultClientScript"

content="JavaScript">
> <meta name="vs_targetSchema"
>content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form id="Form1" method="post"

runat="server">
> <FONT face="Arial"></FONT>
> </form>
> <table width="100%">
> <tr>
> <td align="center"><font

size="+3">My Report</font></td>
> <tr>
> <td align="center"><font

size="+3">BP Cases Status Report</font></td>
> <tr>
> <td>
> <table border="0"

width="100%" cellspacing="3" cellpadding="0">
> <tr

bgcolor="#bbbbbb">
>

<td>
>

Lead Plaintiff<td>
>

Jurisdiction<td>
>

Court<td>
> In-

House Counsel<td>
> #

of Pltfs<td>
>

Status<td>BP Billing Breakdown</td>
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </body>
></HTML>
>----------------------------------------------------------

----------
>
>10. Build and run the application. Now we can see the

table in MS word.
>
>Does it answer your question? If I have misunderstood

your concern, please
>feel free to let me know.
>
>Best regards,
>
>Jacob Yang
>Microsoft Online Partner Support
>Get Secure! 每 www.microsoft.com/security
>This posting is provided "as is" with no warranties and

confers no rights.
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Word Documents with Perl amerar@iwc.net Perl Misc 5 04-07-2007 01:29 AM
Creating Word Documents Brian Cryer ASP .Net 3 02-01-2007 04:55 PM
No more stuff on C:\Documents and Settings\[User]\My Documents\Visual Studio 2005\ craigkenisston@hotmail.com ASP .Net 1 10-18-2006 03:31 PM
ASP Creating word documents(content-disposition) Tom ASP General 2 02-23-2006 10:02 PM
Editing Word documents in Perl (Openoffice Writer or MS Word) Tony Perl Misc 2 09-01-2003 09:48 PM



Advertisments