0
我試圖這樣做兩天現在: 在Mac上使用LibreOffice 5.4。LibreOffice包括一個過濾器宏
我有CSV文件與幾個約會,日期等 什麼我需要這個文件做的打開,正在過濾今天的所有約會。我到目前爲止的是,我檢查每一行,並將1
添加到最後一行,如果它匹配或添加0
如果今天不是今天。
其實我記錄了我的動作,所以我現在的宏並不是最優的,這就是爲什麼我沒有發佈它。
https://picload.org/thumbnail/rwwiiaaa/image.jpg 這裏是一張表的一部分的圖片。 這是我的宏至今:
sub csvfilter
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$AI$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "StringName"
args2(0).Value = "=TEXT(TODAY();"+CHR$(34)+"YYYY-MM-DD"+CHR$(34)+")"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "StringName"
args4(0).Value = "=IF(AI$1=LEFTB(C2;10);"+CHR$(34)+"1"+CHR$(34)+";"+CHR$(34)+"0"+CHR$(34)+")"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args4())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "ToPoint"
args6(0).Value = "$AI$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6())
oSheet = thisComponent.sheets(0)
ocursor = oSheet.createCursor()
ocursor.gotoStart()
ocursor.gotoEndofUsedArea(false)
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "EndCell"
args7(0).Value = "$AI" & ocursor.getRangeAddress.endRow+1
dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "ToPoint"
args8(0).Value = "$AI$2:$AI$18"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "ToPoint"
args9(0).Value = "$AI$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args9())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:DataFilterStandardFilter", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:FilterExecute", "", 0, Array())
end sub
我的問題是,我怎麼能在宏內部的最後一排,篩選了1
S'
首先你應該添加你的代碼,你已經嘗試過什麼(即使是錯誤的,不完美的或東西),所以任何人誰幫助有事與...合作。 (2)CSV文件中不能有宏(只能保存數據)。 (3)如果可以,請還提供您的工作表的屏幕截圖。如果人們能夠看到哪些數據位於哪一列,那麼人們就會更容易理解諸如「*過濾所有今天的約會*」之類的東西。 –
在我的文章中添加了我的代碼csv文件的圖片(因爲我認爲necesarry的部分,因爲它包含大量的個人信息) –
圖片太小,無法閱讀。 –