cfspreadsheet fails to read empty rows

拥有回忆 提交于 2019-12-12 22:06:34

问题


  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?


回答1:


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.




回答2:


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)#&nbsp;</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?



来源:https://stackoverflow.com/questions/8058144/cfspreadsheet-fails-to-read-empty-rows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!