![](/img/trans.png)
[英]libreoffice calc concatenation of strings, function name in different language
[英]Libreoffice calc: function that deletes rows
我是 Libreoffice Calc 的新手。
我的 if/else function 填充新工作表中的單元格。
function 在新工作表中生成大量空行。
是否可以使用 function 刪除那些空行?
就像是:
=IF(NOT(ISEMPTY(sheet1.A1));sheet2.A1; delete row ???)
還是應該用宏來完成?
非常歡迎任何幫助我入門的幫助。
我不確定 Standard Filter 是如何工作的,但我只是編寫了這個應該可以解決問題的宏代碼。 假設:
const cMaxBlankRows = 100 ' stop processing if there are more than this number of blanks in a row
const cMaxRows = 1048575 ' LibreOffice max number of rows - 1, it is zero based
Sub subDeleteBlankRows()
oDoc = ThisComponent
oSheet1 = oDoc.getCurrentController().getActiveSheet()
iIdx = 0
iConBlank = 0 ' number of continuous blanks
Do While iIdx <= cMaxRows
oCell = oSheet1.getCellByPosition(0,iIdx)
If oCell.getType() = com.sun.star.table.CellContentType.EMPTY OR Len(oCell.getString()) = 0 Then
' found an empty cell, delete the row
oSheet1.Rows.removeByIndex(iIdx,1)
iConBlank = iConBlank + 1
' don't advance iIdx
if iConBlank > cMaxBlankRows Then Exit Do
Else
iIdx = iIdx + 1
iConBlank = 0
End If
Loop
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.