OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Insert Special Character via macro *inside a cell*

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
Casius
Newbie
Newbie


Joined: 22 Mar 2006
Posts: 1

PostPosted: Wed Mar 22, 2006 6:50 am    Post subject: Insert Special Character via macro *inside a cell* Reply with quote

(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
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Wed Mar 22, 2006 8:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Thu Mar 23, 2006 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group