commit c63614bb3b8dfbc55a3997ffd4fb2342aff163c0
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sun, 16 Jun 2024 20:58:37 +0530
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sun, 16 Jun 2024 20:58:37 +0530
Initial Commit
5 files changed, 144 insertions(+), 0 deletions(-)
A
|
123
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/Standard/Module1.xba b/Standard/Module1.xba @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">Sub RemoveFreezedCells + s = ThisComponent.Sheets(0) + a = s.freezeAtPosition(0,1) + 'iFreezeRow = s.getPropertyValue("SplitRow") + 'MsgBox iFreezeRow +End Sub + +Rem Copy this to do the Windows Macros + +Sub RemoveExtraMergeCells + Dim oSheet as Variant + Dim cursor as Object + Dim oRange as Object + Dim oSortFields(0) as new com.sun.star.util.SortField + Dim oSortDesc(0) as new com.sun.star.beans.PropertyValue + Dim lastRow as Integer + + oSheet = ThisComponent.Sheets(0) + + cursor = oSheet.createCursor() + cursor.gotoStartOfUsedArea(False) + cursor.gotoEndOfUsedArea(True) + lastRow = cursor.RangeAddress.EndRow + lastColumn = cursor.RangeAddress.EndColumn + + rem set the range on which to sort' + + 'oRange = oSheet.getCellRangeByName("A2:F20") + oRange = oSheet.getCellRangeByPosition(0, 0, lastColumn, 0) + ThisComponent.getCurrentController.select(oRange) + initialColumnCount = oRange.Columns.getCount() - 1 + deletedColumns = 0 + For j = 0 To (initialColumnCount - deletedColumns) + oCell = oRange.getCellByPosition(j, 0) + con = oCell.String + If con = "" Then + oRange.Columns.removeByIndex(j, 1) + deletedColumns = deletedColumns - 1 + Else + Print con + End If + Next +End Sub + +Sub SortAreaName + Dim oSheet as Variant + Dim cursor as Object + Dim oRange as Object + Dim oSortFields(0) as new com.sun.star.util.SortField + Dim oSortDesc(0) as new com.sun.star.beans.PropertyValue + Dim lastRow as Integer + + oSheet = ThisComponent.Sheets(0) + + cursor = oSheet.createCursor() + cursor.gotoStartOfUsedArea(False) + cursor.gotoEndOfUsedArea(True) + lastRow = cursor.RangeAddress.EndRow + + rem set the range on which to sort' + 'oRange = oSheet.getCellRangeByPosition(0, 0, oSheet.Columns.Count - 1, oSheet.Rows.Count - 1) + 'oRange = oSheet.getCellRangeByName("A2:F20") + oRange = oSheet.getCellRangeByPosition(0, 1, 5, lastRow) + 'ThisComponent.getCurrentController.select(oRange) + + oSortFields(0).Field = 0 + oSortFields(0).SortAscending = True + + oSortDesc(0).Name = "SortFields" + oSortDesc(0).Value = oSortFields + + oRange.Sort(oSortDesc) +End Sub + +Sub SortTest + oSheet = ThisComponent.Sheets(0) + oRange = oSheet.queryContentCells(com.sun.star.sheet.CellFlags.VALUE) + + MsgBox oRange.Rows.Count + Exit Sub + + for x = 1 to oRange.Rows.Count + for y = 1 to oRange.Columns.Count + oSheet.getCellByPosition(x, y).Value = 0 + + next y + next x + +End Sub + +Sub Main + AssignVars + SortTest + rem SortAreaName +End Sub + +sub UnFreezeSelection + dim document as object + dim dispatcher as object + document = ThisComponent.CurrentController.Frame + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + dispatcher.executeDispatch(document, ".uno:FreezePanes", "", 0, Array()) +end sub + +sub SortAscendingRecorded +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 ---------------------------------------------------------------------- +dispatcher.executeDispatch(document, ".uno:SortAscending", "", 0, Array()) + + +end sub +</script:module>+ \ No newline at end of file
diff --git a/Standard/dialog.xlb b/Standard/dialog.xlb @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"/>
diff --git a/Standard/script.xlb b/Standard/script.xlb @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="Module1"/> +</library:library>+ \ No newline at end of file
diff --git a/dialog.xlc b/dialog.xlc @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd"> +<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink"> + <library:library library:name="Standard" xlink:href="$(USER)/basic/Standard/dialog.xlb/" xlink:type="simple" library:link="false"/> +</library:libraries>+ \ No newline at end of file
diff --git a/script.xlc b/script.xlc @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd"> +<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink"> + <library:library library:name="Standard" xlink:href="$(USER)/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/> +</library:libraries>+ \ No newline at end of file