| View previous topic :: View next topic |
| Author |
Message |
Casius Newbie

Joined: 22 Mar 2006 Posts: 1
|
Posted: Wed Mar 22, 2006 6:50 am Post subject: Insert Special Character via macro *inside a cell* |
|
|
(I'm fairly new to OOo so I'm sorry if this question is obvious. I did what reading I could before posting this.)
I read the How To Insert Special Characters (updated) guide on the How-To's page. The macro works fine when a cell is selected but not when editing it directly. However, when editing it directly inside a cell, it only brings up the "Insert Special Character" window but not inserting the specific character.
I'm using OOo 1.1.5.
Thanks. |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Wed Mar 22, 2006 8:36 pm Post subject: |
|
|
| My guess is that you recorded a macro to ENTER a special character. If you want to edit the cell, record a macro without using the enter key. Your present macro probably uses a command like uno:EnterString whereas you want uno:InsertSymbol. When recording the macro, use the procedure that you want the macro to replicate. |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Thu Mar 23, 2006 1:46 am Post subject: |
|
|
Yes I just had the same result when inserting a commercial brand name followed by the trademark special character. The recorder does, however, work where you use Insert >Special Character alone, the following being an example:
| Code: | sub SpecChar
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(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Font.StyleName"
args1(0).Value = "Condensed"
args1(1).Name = "Font.Pitch"
args1(1).Value = 2
args1(2).Name = "Font.CharSet"
args1(2).Value = -1
args1(3).Name = "Font.Family"
args1(3).Value = 5
args1(4).Name = "Font.FamilyName"
args1(4).Value = "DejaVu Sans Condensed"
args1(5).Name = "Symbols"
args1(5).Value = "©"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())
end sub |
The difficulties of using a macro generally to manipulate the input line were discussed recently here and here.
Inserting a special character alone into the input line is recorded as is the actual entry of anything into a cell but, based on recent discussion, it seems that anything else is beyond the capacity of the programming interface.
My suggestion is that you use a macro such as that shown to insert a special character BEFORE doing any other editing. If you wish to use more than one character in a cell, record a macro inserting both. |
|
| Back to top |
|
 |
|