400分求助一个asp新闻发布系统中的问题(200分)

W

wyic

Unregistered / Unconfirmed
GUEST, unregistred user!
我做一个asp的新闻发布系统,一个问题,求解决。
我在新闻发布系统中,有一个新闻发布页面。一般编辑新闻是用到像论坛一样的输入框。
现在我想改成一个上传按钮,直接上传我的word文档,在显示页面又像正常新闻那个显示出来。非word显示。
怎么做,最好有代码
 
用Com吧,代码没有!
 
那个不可能,你可以把word文件save as成web页面,然后放置到新闻页面中,我就是这样做的。。。
 
to: whtsuperant,
怎么用com
to 迈克老狼
点上传的时候,怎么save as呢?还有我要把新闻标题显示在主页面中,怎么读取 word中的第一行标题
 
把WORD文件转换为HTML文件,再上传
 
客户不懂啊,只会点一下word,
不然我叫他们复制一下,贴到输入框就行了
 
我就是这么教育客户的,他们习惯乐了,也就没什么问题,。。。
 
當然可以啊! 如下:<%
' 讀取意見發表表單網頁中的各欄位的資料
name = Request("name")
email = Request("email")
subject = Request("subject")
textmemo = Request("textmemo")
' 檢查各欄位是否空白沒有填寫資料

'以下為讀入資料的處理,先將讀入的欄位資料改寫成
'HTML形式以方便『觀看意見留言結果』網頁取用
' 第一行為處理姓名欄位資料
Line1 = "留言者:" &amp;
name &amp;
"<BR>"
'第二行為處理E-Mail欄位資料
Line2 = "<A HREF=mailto:" &amp;
Email &amp;
">" &amp;
Email &amp;
"</A><BR>"
' 第三行為處理主題欄位資料
Line3 = "主 題:" &amp;
subject &amp;
"<BR>"
' 第四行為處理留言內容
'必須先將留言內容中的跳行字元 vbCrLf 取代成為 <BR>
textmemo = Replace( textmemo, vbCrLf, "<BR>" )
' 因為留言內容是多行的文字欄位,所以我們利用表格形式顯示
Line4 = "<TABLE BORDER=0><TR><TD>"
Line4 = Line4 &amp;
textmemo &amp;
"</TD></TR></TABLE>"
On Error Resume Next
' 建立 FileSystemObject 物件
Set fileobject = Server.CreateObject("Scripting.FileSystemObject")
Application.Lock
' 取得 information.txt 及 oldinfo.txt 的完整路徑
FilePath = Server.MapPath("information.txt")
OldFilePath = Server.MapPath("oldinfo.txt")
' 將 information.txt 更名複製為 oldinfo.txt
fileobject.MoveFile FilePath, OldFilePath
' 開啟 oldinfo.txt
Set TEMP = fileobject.OpenTextFile(OldFilePath, , True)
' 建立 information.txt 來寫入新的意見留言
Set newmessage = fileobject.CreateTextFile(FilePath)
' 將新的意見留言資料寫入 information.txt
newmessage.WriteLine Line1
newmessage.WriteLine Line2
newmessage.WriteLine Line3
newmessage.WriteLine Line4
newmessage.WriteLine "<HR>"
' 一次讀取整個 oldinfo.txt的資料(已經存在於TEMP),
' 然後將位於oldinfo.txt 中舊的意見留言合併寫入 information.txt
newmessage.WriteLine TEMP.ReadAll
' 資料寫入完畢後,關閉 information.txt
TEMP.Close
' 刪除已經沒有用處的 oldinfo.txt
fileobject.DeleteFile OldFilePath, True
Application.UnLock
' 將合併後的最新留言資料與舊的意見留言資料
'『轉向』輸出到『觀看意見留言結果』的網頁
'『message.asp』中
Response.Redirect "message.asp"
%>
============如下是將TXT文件讀出來,你改一下,肯定行==
<html>
<head>
<script>
var x,y
var step=40
var flag=0
var message="歡迎你來此留言!"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length;i++) {
xpos=-50}
var ypos=new Array()
for (i=0;i<=message.length;i++) {
ypos=-50}
function handlerMM(e){
x = (document.layers) ? e.pageX :do
cument.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY :do
cument.body.scrollTop+event.clientY
flag=1}
function makeit() {
if (flag==1 &amp;&amp;
document.all) {
for (i=message.length;
i>=1;
i--) {
xpos=xpos[i-1]+step
ypos=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0;
i<message.length;
i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos
thisspan.posTop=ypos } }
else
if (flag==1 &amp;&amp;
document.layers) {
for (i=message.length;
i>=1;
i--) {
xpos=xpos[i-1]+step
ypos=ypos[i-1] }
xpos[0]=x+step
ypos[0]=y
for (i=0;
i<message.length;
i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos
thisspan.top=ypos} }
var timer=setTimeout("makeit()",30)}
for (i=0;i<=message.length;i++) {
do
cument.write("<span id='span"+i+"'class='spanstyle'>")
document.write(message)
do
cument.write("</span>")}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove = handlerMM;
</script>
<title>我的論壇</title>
<style type="text/css">
.spanstyle {position:absolute;visibility:visible;top:-50px;font-size:9pt;color: #c800c0;font-weight:bold;}</style>
</head>
<body background="10.JPG">
<h2 align=center>留言瀏覽</hr>
<hr size="1" color="blue">
<font size=2><!--#include file="information.txt"--></font>
<hr size="1" color="blue">
<center><a href="wflt.asp">請你留言</a></ecnter><p>

</body>
</html>
 
默认的word不是纯文本文件吧?
 
你改一下試試,我沒有試過,我看書上說行的,應該行的
 
我的word不是留言啊,是不规则的
 
意思是叫你來活用這個:
Set TEMP = fileobject.OpenTextFile(OldFilePath, , True)
 
老兄啊,上传的word又不让用word打开,怎么办?难道用第三方控件不成
 
上傳啊,我目前手上沒有代碼:)結案別忘了給點分
 
上面的在浏览器中打开的时候正常网页显示出来,不是内嵌world的方法,老实说我还真没有看过。
我想asp这个语言是没有本事把一个word文件的标题和内容等等分离并且显示这样一个功能吧。
 
樓上的說得也許有道理, 我沒有試過,也不知道會如何:(
 
如果有一种可能就是.net中是否带了操作word文件的功能?通过.net的功能把word文件转化成html文件,单是word文件存成html后,图片目录又是个问题,我觉得楼主恐怕实现不了,这个问题曾经也困扰了我很久...
 

Similar threads

D
回复
0
查看
706
DelphiTeacher的专栏
D
D
回复
0
查看
613
DelphiTeacher的专栏
D
顶部