gpt4 book ai didi

coldfusion - Cold Fusion 2018 : how to save . xlsx 文件为 .csv

转载 作者:行者123 更新时间:2023-12-02 19:03:57 26 4
gpt4 key购买 nike

Win2019上的CF2018尝试将用户上传的 .xlsx 文件另存为 .csv 文件以在 Oracle 数据库中处理。运行此代码,它完成时没有错误,但结果不清晰:

<cfspreadsheet action = "read"
format="csv"
src="c:\bin\Nov_sales.xlsx"
name="foo"
>

<cfspreadsheet action="write"
filename='c:\bin\Nov_sales.csv'
format="csv"
name="foo"
overwrite=true>

.csv 文件中的结果如下所示:

504b 0304 1400 0808 0800 d260 8f51 0000
0000 0000 0000 0000 0000 0b00 0000 5f72
656c 732f 2e72 656c 73ad 92c1 4a03 3110
865f 25cc bd9b 6d05 1169 da8b 08bd 89d4
.....

我错过了什么???

最佳答案

“cfspreadsheet 标记始终将电子表格数据写入 XLS 文件。要将 HTML 变量或 CSV 变量写入 HTML 或 CSV 文件,请使用 cffile 标记。”

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-r-s/cfspreadsheet.html

或者换句话说,当使用cfspreadsheet action="write"时,format属性不指定输出格式,它指定输入格式 - 因为它可以是 CF 电子表格对象、查询、CSV 字符串或 HTML 字符串中的任何一种。

您会在 .csv 文件中看到原始字节,因为无论 .csv 文件扩展名如何,它实际上都是一个 Excel 文件。

关于coldfusion - Cold Fusion 2018 : how to save . xlsx 文件为 .csv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65311634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com