在页面上创建Word文档 [英] Creating Word documents on page

查看:52
本文介绍了在页面上创建Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一些代码,展示了如何将html

表单转换为Word。消息说只需在Page_load中放入以下



Response.ContentType =" application / ms-word"

Response.AddHeader(" content-disposition"," inline;

filename = BP_CaseStatus.doc")


现在我只需要如果我打算在浏览器中显示它,那就像创建页面一样。




我在浏览器中使用类似的代码创建文档

以下内容:

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

报告< / font>< / tr>")

Response.Write("< tr>< td align = center>< font size = + 3> BP

案例状态报告< / font>< / tr>")


''============= =================================

''主表

''============================================= =

Response.Write(" < tr>< td>")

Response.Write(" table border = 0 width ="" 100%""

CELLSPACING = 3 CELLPADDING = 0>")

回复于("< TR BGCOLOR =#BBBBBB>< TD>铅

原告< TD>管辖权< TD>阁< TD>在内务

律师< Pltfs<的#; TD> TD>状态< TD> BP帐单

击穿< / TR>" )

Response.Write("< / table>")

Response.Write("< / tr>")

''============================================= =

''主表

''=========================== ===================

Response.Write("< / table>")

页面加载正常,直到我尝试将其作为Word

文档加载。我知道有人在那里做过。


有人可以帮忙吗?


谢谢

enak


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


推荐答案

你是什么意思直到......什么样的eroor你会得到



你为什么要使用Response.Write?你在做ASP.NET

还是ASP?
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 ?
-----原帖-----
我找到了一些代码这显示了如何将html
表单转换为Word。消息说只是把
跟在Page_load中:

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

现在我所要做的就是像
一样创建页面如果我打算将它显示在浏览器。

我使用类似
的代码在浏览器中创建文档:

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
报告< / font>< / tr>")
Response.Write("< tr>< td align = center>< font size = + 3> BP
案例状态报告< / font>< / tr>")

''========== ====================================
''主表
'' ==============================================
回复于(" < tr>< td>")
Response.Write(" table border = 0 width ="" 100%""
cellspacing = 3 cellpadding = 0> ")
回复于("< TR BGCOLOR =#BBBBBB>< TD>铅
原告< TD>管辖权< TD>阁< TD>在内务
法律顾问及LT ; td> #tltfs< td>状态< td> BP Billing
细分< / tr>")
Response.Write("< / table>")
响应.Write("< / tr>")
''=============================== ===============
''主表
''===================== =========================
Response.Write("< / table>")

页面加载正常,直到我尝试将其作为Word
文档加载。我知道有人在那里做过。

任何人都可以帮忙吗?

感谢
enak


-----Original Message-----
I have found some code that shows how to convert an html
form to Word. The message said to simply put the followingin 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 Iwould if I were going to display it in the browser.

I create the document in the browser using code similar tothe 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


.



感谢您的回复。


我正在使用asp.net。如果我尝试显示只有

的页面,页面显示的HTML就像我期望的那样。


但是,如果我在页面中添加以下两行

空白:


Response.ContentType =" application / ms-word"

Response.AddHeader(" content -disposition"," inline;

filename = BP_CaseStatus.doc")


目前,我正在使用HTML但是我应该这样做

不同?我可以使用数据网格而不是< table> ;?


谢谢,

enak
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
--- - 原始消息-----
你是什么意思直到......。你得到了什么样的生活?

为什么你使用Response.Write?你在做ASP.NET
或ASP吗?
-----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 ?
-----原帖-----
我找到了一些代码,说明如何将html
表单转换为Word。消息说只是将
-----Original Message-----
I have found some code that shows how to convert an html
form to Word. The message said to simply put the


放在Page_load中的


following

之后:

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

现在我所要做的就是创建页面就像
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


如果我要在浏览器中显示它。

我使用类似的代码在浏览器中创建文档
would if I were going to display it in the browser.

I create the document in the browser using code similar


以下内容:

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
报告< / font>< / tr> ")
Response.Write("< tr>< td align = center>< font size = + 3> BP
案例状态报告< / font>< / tr>")

''=== ========================================== =
''主要表
''=========================================== == =
Response.Write(" < tr>< td>")
Response.Write(" table border = 0 width ="" 100%""
cellspacing = 3 cellpadding = 0> ")
回复于("< TR BGCOLOR =#BBBBBB>< TD>铅
原告< TD>管辖权< TD>阁< TD>在内务
法律顾问及LT ; td> #tltfs< td>状态< td> BP Billing
细分< / tr>")
Response.Write("< / table>")
响应.Write("< / tr>")
''=============================== ============== =
''主表
''===================== ======================== =
Response.Write("< / table>")

页面加载正常,直到我尝试将其作为Word
文档加载。我知道有人在那里做过。

任何人都可以帮忙吗?

感谢
enak


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


.




我刚刚尝试了你的代码并且它可以正常工作(如果你这样做的话,请不要这样做。

a页面加载。仅在button_click事件的回发中

例如)。


仅当你至少拥有office 2000和IE时才能工作/>
5.5。
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.
-----原始消息-----
感谢您的回复。

我正在使用asp。净。如果我尝试用
显示页面,那么页面显示的HTML就像我期望的那样。

但是,如果我添加以下两行,页面是空白的:

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

目前,我正在使用HTML,但我应该这样做吗?我可以使用数据网格而不是< table> ;?

谢谢,
enak
-----Original Message-----
Thanks for your response.

I am using asp.net. If I try to display the page with justthe 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
-----原帖---- -
你是什么意思直到......才行。你得到了什么样的生活?

为什么你使用Response.Write?你在做
ASP.NET或ASP吗?
-----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.NETor ASP ?
-----原始消息-----
我找到了一些显示如何转换的代码一个
htmlform到Word。消息说只是将
-----Original Message-----
I have found some code that shows how to convert an htmlform to Word. The message said to simply put the


放在Page_load中的


following

之后:

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

现在我所要做的就是创建页面
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


likeI

likeI

如果我要在浏览器中显示它。

我使用类似的代码
would if I were going to display it in the browser.

I create the document in the browser using code similar

<在浏览器中创建文档br /> to


to

以下内容:

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
报告< / font>< / tr>" ;)
Response.Write(" t r>< td align = center>< font size = + 3> BP
案例状态报告< / font>< / tr>")

''=== ========================================= ==
''主要表
''=========================================== = ==
Response.Write(" < tr>< td>")
Response.Write(" table border = 0 width ="" 100%""
cellspacing = 3 cellpadding = 0> ")
回复于("< TR BGCOLOR =#BBBBBB>< TD>铅
原告< TD>管辖权< TD>阁< TD>在内务
法律顾问及LT ; td> #tltfs< td>状态< td> BP Billing
细分< / tr>")
Response.Write("< / table>")
响应.Write("< / tr>")
''=============================== ============= ==
''主表
''===================== ======================= ==
Response.Write("< / table>")

页面加载正常,直到我尝试将其作为Word
文档加载。我知道有人在那里做过。

任何人都可以帮忙吗?

感谢
enak


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


.





这篇关于在页面上创建Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆