生成电子表格 [英] generate spreadsheet

查看:92
本文介绍了生成电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%Response.contenttype =" application / vnd.ms-excel" %>

<%Response.AddHeader" Content-Disposition"," filename = hardware.xls" %>


我正在使用上面的行从记录集生成电子表格。

之一记录集字段包含HTML数据。每当生成电子表格时,它都会将一些HTML数据放入新行中。相同的列,

但不同的行。有没有办法解决这个问题?


是否可以轻松创建可以使用的DBF或CSV文件?

感谢

解决方案

我确定还有其他方法可以运行命令shell,但这个免费赠品已经

总是为我工作:


请参阅AspExec:
http: //www.serverobjects.com/products.htm#free


" shank" < SH *** @ tampabay.rr.com>在消息中写道

news:Og ************** @ TK2MSFTNGP12.phx.gbl ...

<%Response。 contenttype =" application / vnd.ms-excel" %>
<%Response.AddHeader" Content-Disposition"," filename = hardware.xls" %>

我正在使用上面的行从记录集生成电子表格。一个
的记录集字段包含HTML数据。每当生成电子表格时,它都会将一些HTML数据放入新行中。相同的
列,但行不同。有没有办法解决这个问题?

是否可以轻松创建一个可以工作的DBF或CSV文件?
感谢



对不起 - 回复了错误的帖子!

" Mike Florio" < MI ** @ micro-point.com>在消息中写道

新闻:10 ************* @ corp.supernews.com ...

我肯定在那里是运行命令shell的其他方法,但这个免费赠品
一直对我有用:

请参阅AspExec:
http://www.serverobjects.com/products.htm#free

小腿 < SH *** @ tampabay.rr.com>在消息中写道
新闻:Og ************** @ TK2MSFTNGP12.phx.gbl ...

<%Response.contenttype ="应用/ vnd.ms-的excel" %>
<%Response.AddHeader" Content-Disposition"," filename = hardware.xls" %>

我正在使用上面的行从记录集生成电子表格。
一个

记录集字段包含HTML数据。每当生成电子表格



时,它都会将一些HTML数据放入新行中。同样适当的


列,

但不同的行。有没有办法解决这个问题?

是否可以轻松创建一个可以工作的DBF或CSV文件?
感谢




我从不信任这种方法,而CSV则没有bells n

哨声。一个XLS,如果您想要的只是表格文件中的数据... CSV必须

格式...


你可以这样做*真的*很容易打开myfile.csv使用FSO和

将您的数据用逗号分隔...请记住,如果您的数据中包含vommas

,则必须在写出之前将其翻译出来或者将

违规字符串括在"


我使用的代码中(高度切碎,我使用unixtime和会话ID来制作一个
唯一文件名)


设置trs = Server.CreateObject(" ADODB.Recordset")

trs.open sql,objconn,3 ,3

alldata = trs.GetRows


strPathInfo =" TempCSV /" &安培;会话(sessionid)& Datediff(s,

" 1/1 / 1970",现在)& " .csv"

strPhysicalPath = Server.MapPath(strPathInfo)

set fs = Server.CreateObject(" Scripting.FileSystemObject")

set f = fs.OpenTextFile(strPhysicalPath,8,true,TristateF alse)


for n = 0 to ubound(alldata,2)

ln =""

,m = 0到ubound(alldata,1)

ln = ln& chr(34)&修剪(alldata(m,n))& chr(34)& ","

next

f.WriteLine(ln)

next


f .close

objconn.close

设置objconn =没有

设置trs =没有

set fs = nothing

设f =没有


H


" shank" < SH *** @ tampabay.rr.com>在消息中写道

news:Og ************** @ TK2MSFTNGP12.phx.gbl ...

<%Response。 contenttype =" application / vnd.ms-excel" %>
<%Response.AddHeader" Content-Disposition"," filename = hardware.xls" %>

我正在使用上面的行从记录集生成电子表格。一个
的记录集字段包含HTML数据。每当生成电子表格时,它都会将一些HTML数据放入新行中。相同的
列,但行不同。有没有办法解决这个问题?

是否可以轻松创建一个可以工作的DBF或CSV文件?
感谢



<% Response.contenttype = "application/vnd.ms-excel" %>
<% Response.AddHeader "Content-Disposition", "filename=hardware.xls" %>

I''m using the above lines to generate a spreadsheet from a recordset. One of
the recordset fields has HTML data. Whenever the spreadsheet is generated,
it will place some of the HTML data into new rows. Same appropriate column,
but different rows. Is there a way around this?

Is there an easy to create a DBF or CSV file that would work?
thanks

解决方案

I''m sure there are other ways to run the command shell, but this freebie has
always worked for me:

see AspExec at:
http://www.serverobjects.com/products.htm#free


"shank" <sh***@tampabay.rr.com> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...

<% Response.contenttype = "application/vnd.ms-excel" %>
<% Response.AddHeader "Content-Disposition", "filename=hardware.xls" %>

I''m using the above lines to generate a spreadsheet from a recordset. One of the recordset fields has HTML data. Whenever the spreadsheet is generated,
it will place some of the HTML data into new rows. Same appropriate column, but different rows. Is there a way around this?

Is there an easy to create a DBF or CSV file that would work?
thanks



Sorry - replied to the wrong post !
"Mike Florio" <mi**@micro-point.com> wrote in message
news:10*************@corp.supernews.com...

I''m sure there are other ways to run the command shell, but this freebie has always worked for me:

see AspExec at:
http://www.serverobjects.com/products.htm#free


"shank" <sh***@tampabay.rr.com> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...

<% Response.contenttype = "application/vnd.ms-excel" %>
<% Response.AddHeader "Content-Disposition", "filename=hardware.xls" %>

I''m using the above lines to generate a spreadsheet from a recordset. One

of

the recordset fields has HTML data. Whenever the spreadsheet is


generated, it will place some of the HTML data into new rows. Same appropriate


column,

but different rows. Is there a way around this?

Is there an easy to create a DBF or CSV file that would work?
thanks




I never trusted this method and whereas CSVs don''t have the "bells n
whistles" of an XLS, if all you want is data in a tabular file... CSV has to
be the format...

you can do this *really* easily just open "myfile.csv" with the FSO and
right your data seperated by commas... remember that if your data has vommas
in it, you''ll have to translate them before writing out or enclose the
offending string in ""

the code I use (highly chopped and I use unixtime and session ID to make a
unique filename)

Set trs = Server.CreateObject("ADODB.Recordset")
trs.open sql, objconn ,3 ,3
alldata=trs.GetRows

strPathInfo = "TempCSV/" & session("sessionid") & Datediff("s",
"1/1/1970",now) & ".csv"
strPhysicalPath = Server.MapPath (strPathInfo)
set fs=Server.CreateObject("Scripting.FileSystemObject ")
set f=fs.OpenTextFile(strPhysicalPath,8,true,TristateF alse)

for n=0 to ubound(alldata,2)
ln=""
for m=0 to ubound(alldata,1)
ln=ln & chr(34) & trim(alldata(m,n)) & chr(34) & ","
next
f.WriteLine(ln)
next

f.close
objconn.close
Set objconn = nothing
Set trs = nothing
set fs=nothing
set f=nothing

H

"shank" <sh***@tampabay.rr.com> wrote in message
news:Og**************@TK2MSFTNGP12.phx.gbl...

<% Response.contenttype = "application/vnd.ms-excel" %>
<% Response.AddHeader "Content-Disposition", "filename=hardware.xls" %>

I''m using the above lines to generate a spreadsheet from a recordset. One of the recordset fields has HTML data. Whenever the spreadsheet is generated,
it will place some of the HTML data into new rows. Same appropriate column, but different rows. Is there a way around this?

Is there an easy to create a DBF or CSV file that would work?
thanks



这篇关于生成电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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