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
[color=blue]
>-----Original Message-----
>Hi Enak,
>
>Thank you for your update.
>
>I have already tested your code on my side. Please try [/color]
the following steps [color=blue]
>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 [/color]
size=+3>My [color=blue]
>Report</font></tr>")
> Response.Write(" <tr><td align=center><font [/color]
size=+3>BP Cases Status [color=blue]
>Report</font></tr>")
>
> '==============================================
> 'MAIN TABLE
> '==============================================
> Response.Write(" <tr><td>")
> Response.Write(" <table border=0 width=""100%"" [/color]
cellspacing=3 [color=blue]
>cellpadding=0>")
> Response.Write(" <tr bgcolor=#bbbbbb><td>Lead
>Plaintiff<td>Jurisdiction<td>Court<td>In-House [/color]
Counsel<td># of [color=blue]
>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 [/color]
see the following [color=blue]
>HTML code.
>----------------------------------------------
><table width="100%"> <tr><td align=center><font [/color]
size=+3>My [color=blue]
>Report</font></tr> <tr><td align=center><font size=+3>BP [/color]
Cases Status [color=blue]
>Report</font></tr> <tr><td> <table border=0 width="100%" [/color]
cellspacing=3 [color=blue]
>cellpadding=0> <tr bgcolor=#bbbbbb><td>Lead
>Plaintiff<td>Jurisdiction<td>Court<td>In-House [/color]
Counsel<td># of [color=blue]
>Pltfs<td>Status<td>BP Billing Breakdown</tr> </table> [/color]
</tr></table>[color=blue]
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 [/color]
Transitional//EN">[color=blue]
><HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" content="Microsoft [/color]
Visual Studio .NET 7.1">[color=blue]
> <meta name="CODE_LANGUAGE" content="Visual [/color]
Basic .NET 7.1">[color=blue]
> <meta name="vs_defaultClientScript" [/color]
content="JavaScript">[color=blue]
> <meta name="vs_targetSchema"
>content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form name="Form1" method="post" [/color]
action="WebForm1.aspx" id="Form1">[color=blue]
><input type="hidden" name="__VIEWSTATE"
>value="dDwtMTI3OTMzNDM4NDs7PkHVmr4UQqVvjWev6bWIe9 oveFlT" /
>
>
> <FONT face="Arial"></FONT>
> </form>
> </body>
></HTML>
>----------------------------------------------
>
>6. Then please add the following two statements in [/color]
Page_Load.[color=blue]
>
>Response.ContentType = "application/ms-word"
>Response.AddHeader("content-disposition", "inline;
>filename=BP_CaseStatus.doc")
>
>7. Build and run the application again. After click [/color]
the "Open" button, we [color=blue]
>can find that only the content between "<HTML>" [/color]
and "</HTML>" are converted [color=blue]
>to word. That is the reason of this issue.
>
>8. Then please change the code in Page_Load as the [/color]
following:[color=blue]
>
> Private Sub Page_Load(ByVal sender As System.Object, [/color]
ByVal e As [color=blue]
>System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> Response.ContentType = "application/ms-word"
> Response.AddHeader("content-[/color]
disposition", "inline; [color=blue]
>filename=BP_CaseStatus.doc")
> End Sub
>
>9. Change the HTML code of the web form as the following:
>----------------------------------------------------------[/color]
----------[color=blue]
><%@ Page Language="vb" AutoEventWireup="false"
>Codebehind="WebForm1.aspx.vb" [/color]
Inherits="TestWord.WebForm1"%>[color=blue]
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 [/color]
Transitional//EN">[color=blue]
><HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" content="Microsoft [/color]
Visual Studio .NET 7.1">[color=blue]
> <meta name="CODE_LANGUAGE" content="Visual [/color]
Basic .NET 7.1">[color=blue]
> <meta name="vs_defaultClientScript" [/color]
content="JavaScript">[color=blue]
> <meta name="vs_targetSchema"
>content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form id="Form1" method="post" [/color]
runat="server">[color=blue]
> <FONT face="Arial"></FONT>
> </form>
> <table width="100%">
> <tr>
> <td align="center"><font [/color]
size="+3">My Report</font></td>[color=blue]
> <tr>
> <td align="center"><font [/color]
size="+3">BP Cases Status Report</font></td>[color=blue]
> <tr>
> <td>
> <table border="0" [/color]
width="100%" cellspacing="3" cellpadding="0">[color=blue]
> <tr [/color]
bgcolor="#bbbbbb">[color=blue]
> [/color]
<td>[color=blue]
> [/color]
Lead Plaintiff<td>[color=blue]
> [/color]
Jurisdiction<td>[color=blue]
> [/color]
Court<td>[color=blue]
> In-[/color]
House Counsel<td>[color=blue]
> # [/color]
of Pltfs<td>[color=blue]
> [/color]
Status<td>BP Billing Breakdown</td>[color=blue]
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </body>
></HTML>
>----------------------------------------------------------[/color]
----------[color=blue]
>
>10. Build and run the application. Now we can see the [/color]
table in MS word.[color=blue]
>
>Does it answer your question? If I have misunderstood [/color]
your concern, please [color=blue]
>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 [/color]
confers no rights.[color=blue]
>
>.
>[/color]