cfspreadsheet 无法读取空行

发布于 12-14 04:11 字数 374 浏览 4 评论 0原文

  1. 给定一个包含 N 个逻辑行的电子表格
  2. ,其中一行完全空白*
  3. cfspreadsheet action="read" 将返回 RecordCount 为 N - 1 的查询。

*完全空白row 是每个单元格实际上都是空白的行。请参阅 POI 文档中的 CELL_TYPE_BLANK

cfspreadsheet 是否可以包含空行?

  1. Given a spreadsheet with N logical rows
  2. Where one row is totally blank*
  3. cfspreadsheet action="read" will return a query with a RecordCount of N - 1.

*A totally blank row is a row where every cell is actually blank. See CELL_TYPE_BLANK in the POI docs.

Is it possible for cfspreadsheet to include empty rows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜警司 2024-12-21 04:11:46

不会。由于电子表格数据并不总是连续的, 故意筛选掉空白行,以避免包含大量空白噪声。因此,除非一行至少有一个非空白单元格,否则不会检测到它。 AFAIK,没有设置可以覆盖该行为。您必须利用底层 POI 工作簿并自行构建。

No. Since spreadsheet data is not always contiguous, <cfspreadsheet action="read" query="queryName" ...> and <cfspreadsheet action="read" format="csv|html" ..> deliberately screen out blank rows to avoid including tons of white space noise. So unless a row has at least one non blank cell, it will not be detected. AFAIK, there is no setting to override that behavior. You would have to tap into the underlying POI workbook and roll-your-own.

嗫嚅 2024-12-21 04:11:46

我设置了一个像这样的 xls:

|Row1|Data1|
[blank]
|Row3|Data3|
[blank]
|Row5|Data5|

并在其上运行了以下代码:

<cfspreadsheet action="read" src="c:\temp\book1.xlsx" name="st1">
<table border="1">
<cfloop index="iRow" from="1" to="5">
    <tr>
        <cfloop index="iCol" from="1" to="2">
            <cfoutput><td>#spreadsheetGetCellValue(st1, iRow, iCol)# </td></cfoutput>
        </cfloop>
    </tr>
</cfloop>
</table>

输出是:

|Row1|Data1|
[blank]
|Row3|Data3|
[blank]
|Row5|Data5|

这就是我所期望的。

所以在我看来,空白行受到了很好的尊重......?

我和你做的有什么不同?

I set up an xls like this:

|Row1|Data1|
[blank]
|Row3|Data3|
[blank]
|Row5|Data5|

And ran this code over it:

<cfspreadsheet action="read" src="c:\temp\book1.xlsx" name="st1">
<table border="1">
<cfloop index="iRow" from="1" to="5">
    <tr>
        <cfloop index="iCol" from="1" to="2">
            <cfoutput><td>#spreadsheetGetCellValue(st1, iRow, iCol)# </td></cfoutput>
        </cfloop>
    </tr>
</cfloop>
</table>

And the output was:

|Row1|Data1|
[blank]
|Row3|Data3|
[blank]
|Row5|Data5|

Which is what I'd expect.

So it looks to me like the blank rows are respected just fine...?

What am I doing different from you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文