Sustituir una palabra en varios archivos de texto
Dejo aquí una macro y funciones para desde openoffice sustituir una palabra en varios archivos de texto.
Popularity: 4% [?]
Eliminar filas
Un par de macros interesantes para eliminar filas pares o impares, según necesidad. Estas macros pueden ser sustitudias por la publicada anteriormente, utilizando algún que otro truco, todo es cuestión de prueba-error. De cualquier manera aquí lo dejo:
Eliminar filas pares:
{codecitation class=”brush: vb; gutter: true;” width=”500px”}
Sub eliminaFilasPares()
Dim oRow as Variant
oDocument = ThisComponent
oSelectedCells = oDocument.CurrentSelection
oActiveCells = oSelectedCells.RangeAddress
oSheets = oDocument.Sheets
oSheet = oSheets.getByIndex(oActiveCells.Sheet)`active table
For nRow = oActiveCells.EndRow To oActiveCells.StartRow step -1
If nRow Mod 2 <> 0 Then
Set oRow = oSheet.getRows().getByIndex(nRow)
`Select the row
`ThisComponent.getCurrentController().select(oRow)
`Delete the row from the worksheet
osheet.removeRange(oRow.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
End if
Next
End sub
[/bash]
Eliminar filas impares
{codecitation width=”500px”}
Sub eliminaFilasImpares()
Dim oRow as Variant
oDocument = ThisComponent
oSelectedCells = oDocument.CurrentSelection
oActiveCells = oSelectedCells.RangeAddress
oSheets = oDocument.Sheets
oSheet = oSheets.getByIndex(oActiveCells.Sheet)`active table
For nRow = oActiveCells.EndRow To oActiveCells.StartRow step -1
If nRow Mod 2 <> 0 Then
Set oRow = oSheet.getRows().getByIndex(nRow+1)
`Select the row
`ThisComponent.getCurrentController().select(oRow)
`Delete the row from the worksheet
osheet.removeRange(oRow.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
End if
Next
End sub
[/bash]
Popularity: 3% [?]
Macro para borrar filas con la primera celda vacia
Una macro de utilidad para aquellos que utilizamos con asiduidad hoja de cálculo, es la que dejo a continuación. La misión de esta macro, es la de borrar todas las filas con la primera celda vacía. Con esta macro se pueden hacer muchas cosas. Simplemente con un poquito de imaginación y con un truco que otro, la cosa se puede extender de una manera bárbara. El código:
{codecitation class=”brush: vb; gutter: true;” width=”500px”}
Sub limpialineasprimeravacia()
oDocument = ThisComponent
oSelectedCells = oDocument.CurrentSelection
oActiveCells = oSelectedCells.RangeAddress
oSheets = oDocument.Sheets
oSheet = oSheets.getByIndex(oActiveCells.Sheet)`active table
For nRow = oActiveCells.EndRow To oActiveCells.StartRow step -1
oCell = oSheet.getCellByPosition(0,nRow)
if oCell.getString()=”" then
oRow = oSheet.getRows().getByIndex(nRow)
`Select the row
ThisComponent.getCurrentController().select(oRow)
`Delete the row from the worksheet
osheet.removeRange(oRow.RangeAddress, com.sun.star.sheet.CellDeleteMode.UP)
end if
Next
end sub
[/bash]
Popularity: 5% [?]
Interpola
Aquí dejo una nueva función para la hója de cálculo de openoffice, que permite interpolar entre dos parejas de números, con la idea de facilitar el trabajo.
Function interpola(x1 as double,y1 as double,x2 as double, y2 as double, x as double)as double dim a as double dim b as double if x1=x2 then interpola=(y1+y2)/2 else b=(y1-y2)/(x1-x2) a=(x1*y2-y1*x2)/(x1-x2) interpola=a+b*x end if end function
Popularity: 3% [?]







