is there any way to delete a frame around text in an automated way (a keystroke, a menu item, a macro etc.) ?
i find myself very often in that situation after copy and paste text from web content.
the text is copied with a frame around it.
i have to remove it every time but the manual method is annoying.
(1. cut selected text insede the frame, 2. delete the empty frame, 3. paste the cut text in the frameless blank page).
i found a macro here: http://www.oooforum.org/forum/viewtopic ... move+frame
but it doesn't work
here's a screenshot that shows the frame around text that i wan to remove:
thanks 4 your help
[Solved] Macro to remove frame around text
[Solved] Macro to remove frame around text
Last edited by Tommy on Wed Jul 30, 2008 7:03 pm, edited 1 time in total.
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: macro to remove frame around text
I don't think this is a "frame" - seems to me, that it is the border of actual text width; see:
View>Text borders
(correct translation from my german OOo?)
Did this do the trick?
[posting from vacation: 8°52'55"N 98°16'1" E; actually 29°C]
View>Text borders
(correct translation from my german OOo?)
Did this do the trick?
[posting from vacation: 8°52'55"N 98°16'1" E; actually 29°C]
Re: macro to remove frame around text
well, i'd like to have a macro tool to do that.
i found here some code
http://www.oooforum.org/forum/viewtopic.phtml?t=51300
unfortunately it doesn't work on my PC
i found here some code
http://www.oooforum.org/forum/viewtopic.phtml?t=51300
unfortunately it doesn't work on my PC
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: macro to remove frame around text
The text in the screenshot is in a table. The "frame" is the table boundary. It is "removed" by converting the table to text.
How to remove frames?
How to remove frames?
Re: macro to remove frame around text
I started the macro recorder and got this:Tommy wrote:well, i'd like to have a macro tool to do that.
Code: Select all
sub textbegrenzung
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 = "ViewBounds"
args1(0).Value = false
dispatcher.executeDispatch(document, ".uno:ViewBounds", "", 0, args1())
end sub
Re: macro to remove frame around text
thanks probe1 and sorry for the late reply but i lost contact with this topic.
in the meantime i create this macro that does what i wanted:
however, there's a new problem, if i have more than 1 table in my document, how do i select all the tables in order to use the "RemoveBorder" macro on all of them?
in the meantime i create this macro that does what i wanted:
Code: Select all
sub RemoveTableBorders
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 = "Delimiter"
args1(0).Value = CHR$(9)
dispatcher.executeDispatch(document, ".uno:ConvertTableToText", "", 0, args1())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:ConvertTableToText", "", 0, Array())
end sub
however, there's a new problem, if i have more than 1 table in my document, how do i select all the tables in order to use the "RemoveBorder" macro on all of them?
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Re: macro to remove frame around text
user DVezina posted this great macro on the OOo forum ( http://www.oooforum.org/forum/viewtopic ... 200#293200 ) which does exacty what i needed.
here's the code:
here's the code:
Code: Select all
Sub manageText()
dim dispatcher as object
dim document as object
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
document = ThisComponent.CurrentController.Frame
' Tables
oTextTables = ThisComponent.getTextTables
If NOT oTextTables.hasElements() Then Exit Sub
For i = 0 To oTextTables.getCount() - 1
' Loop through tables
oTable = oTextTables.getByIndex(i)
oRows = oTable.getRows
oColumns = oTable.getColumns
iColCount = oColumns.Count
iRowCount = oRows.Count
' Loop through Cells
For iRow = 0 to iRowCount - 1
For iCol = 0 to iColCount - 1
oCell = oTable.getCellByPosition(iCol, iRow)
oEnum = oCell.createEnumeration()
bTable = False
Do While oEnum.hasMoreElements()
oElement = oEnum.nextElement()
If oElement.supportsService("com.sun.star.text.TextTable") Then
bTable= True
End If
Loop
If oCell.getString() <> "" and bTable = False Then
oCellText = oCell.getText()
oTextCursor = oCellText.createTextCursor()
oVC = ThisComponent.CurrentController.getViewCursor()
oVC.gotoRange(oTextCursor.getEnd(), False)
oText = oVC.getText
' Copy Text to Clip Board
' dispatcher.executeDispatch(document, ".uno:EndOfLineSel", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:EndOfDocumentSel", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
' Go To End of Document
dispatcher.executeDispatch(document, ".uno:GoToEndOfDoc", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:GoToEndOfDoc", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array())
' Paste Text
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
End If
Next
Next
Next
' Once all the text is pasted, loop through tables and delete them.
' We need to do it this way because you have nested tables.
oTextTables = ThisComponent.getTextTables
lCount = oTextTables.getCount()
Do While lCount <> 0
oTable = oTextTables.getByIndex(0)
oTable.dispose()
oTextTables = ThisComponent.getTextTables
lCount = oTextTables.getCount()
Loop
End Sub
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354