|
function getLastRow(url as string) |
|
Dim oArgs(0) As New com.sun.star.beans.PropertyValue |
|
Dim oSheet As Object |
|
oArgs(0).Name="Hidden" |
|
oArgs(0).Value= true |
|
|
|
if 0 < LEN(url) then |
|
oDoc = StarDesktop.LoadComponentFromUrl(url, "_blank", 0, oArgs()) |
|
oSheet = oDoc.getSheets().getByIndex(oDoc.Sheets.Count-1) |
|
else |
|
oSheet = ThisComponent.CurrentController.Activesheet |
|
end if |
|
oRange = oSheet.getCellRangeByName("A1") |
|
oCursor = oSheet.createCursorByRange(oRange) |
|
oCursor.gotoEndOfUsedArea(True) |
|
getLastRow = oCursor.Rows.Count |
|
if 0 < LEN(url) then |
|
oDoc.close(true) |
|
end if |
|
end function |
|
|
|
function getLastColumn(url as string) |
|
Dim oArgs(0) As New com.sun.star.beans.PropertyValue |
|
Dim oSheet As Object |
|
oArgs(0).Name="Hidden" |
|
oArgs(0).Value= true |
|
|
|
if 0 < LEN(url) then |
|
oDoc = StarDesktop.LoadComponentFromUrl(url, "_blank", 0, oArgs()) |
|
oSheet = oDoc.getSheets().getByIndex(oDoc.Sheets.Count-1) |
|
else |
|
oSheet = ThisComponent.CurrentController.Activesheet |
|
end if |
|
oRange = oSheet.getCellRangeByName("A1") |
|
oCursor = oSheet.createCursorByRange(oRange) |
|
oCursor.gotoEndOfUsedArea(True) |
|
getLastColumn = oCursor.Columns.Count |
|
if 0 < LEN(url) then |
|
oDoc.close(true) |
|
end if |
|
end function |
|
|
|
function getBottomCellValue(url as string, num as integer) |
|
Dim oArgs(0) As New com.sun.star.beans.PropertyValue |
|
oArgs(0).Name="Hidden" |
|
oArgs(0).Value= true |
|
|
|
oDoc = StarDesktop.LoadComponentFromUrl(url, "_blank", 0, oArgs()) |
|
oSheet = oDoc.getSheets().getByIndex(oDoc.Sheets.Count-1) |
|
oRange = oSheet.getCellRangeByName("A1") |
|
oCursor = oSheet.createCursorByRange(oRange) |
|
oCursor.gotoEndOfUsedArea(True) |
|
row = oCursor.Rows.Count |
|
oCell = oSheet.getCellByPosition(num-1,row-1) |
|
getBottomCellValue = oCell.value |
|
oDoc.close(true) |
|
end function |
|
|