Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Font related

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kol - 24 Mar 2008 23:02 GMT
What I would like to do is:

Insert fonts (to my vb6 application) from the ' symbol font file ' like
character codes ' 230, 231, 231, 232 ' in a vertical position without
any gap between them to form a tall  ' parentheses '. There's no problem
inserting them with the gap but it's ugly!  How do you adjust the vertical
offset to behave as a single unit or whatever to accomplish this? Any vb
code will be greatly appreciated.

kol
Klaus Linke - 25 Mar 2008 19:28 GMT
Hi kol,

Set the paragraph spacing to "exactly", and the same size as the font size.

Or by macro:
Dim myPara As Paragraph
For Each myPara In Selection.Paragraphs
 With myPara.Format
   .LineSpacingRule = wdLineSpaceExactly
   .LineSpacing = myPara.Range.Characters.First.Font.Size
 End With
Next myPara

Word may still show gaps (even in "print preview"), but the symbol font is
designed so the characters fit nicely with the line spacing equal to the
font size. So the print-out should be perfect.

Regards,
Klaus

> What I would like to do is:
>
[quoted text clipped - 6 lines]
>
> kol
kol - 27 Mar 2008 02:21 GMT
Hi Klaus;

First of all I would like to thank you for your respone and guidance . It's
working great; now I can build any type of parentheses thanks  to you.
I have one more question to you if I may:
So I have the parentheses build say four or five symbols deep. How
do I navigate in otherwords, set the cursor position to each level from vb?
Or do I write my code as I build the parentheses ?

Best regards,

Kol

> Hi kol,
>
[quoted text clipped - 28 lines]
>>
>> kol
Klaus Linke - 27 Mar 2008 16:32 GMT
> So I have the parentheses build say four or five symbols deep. How
> do I navigate in otherwords, set the cursor position to each level from
> vb?
> Or do I write my code as I build the parentheses ?

I'm not sure what your document looks like, and what you try to do with the
macro.

You probably know already, but you can position the parentheses/accolades
with a tab.

BTW, setting the line spacing to equal the font size was pretty stupid.
Usually it would make more sense to set the font size of the symbols to the
line spacing (although you still should use a line spacing of "exactly").
Else it would botch other text you might have in that paragraph.

It isn't done so easily by macro, because Word has problems telling the font
for symbols that you have inserted through "Insert > Symbol". So you have to
get the font through the dialog:

 ' Select the text in which you want to fix the Symbol brackets...
 ' The macro then sets the font size of all symbols in the selection to
equal the line spacing,
 ' and sets the line spacing rule to "exactly".
 Dim myRange As Range
 Dim myChar As Range
 Set myRange = Selection.Range.Duplicate
 Dim dlg As Dialog
 Set dlg = Dialogs(wdDialogInsertSymbol)
 For Each myChar In myRange.Characters
   myChar.Select
   dlg.Update
   If dlg.Font = "Symbol" Then
     Debug.Print dlg.Tab, Hex(dlg.CharNum And &HFFFF&), dlg.CharNumLow,
dlg.Unicode, dlg.Hint
     myChar.Font.Size = myChar.Paragraphs(1).LineSpacing
     myChar.Paragraphs(1).LineSpacingRule = wdLineSpaceExactly
   End If
 Next myChar
 myRange.Select

Regards,
Klaus
kol - 28 Mar 2008 02:43 GMT
Hi Klaus;

This is my(S.R.) and  it might not to be  the best but it works.
What I am trying to do is this:
|    a    |
|   ---- |
|     b   |
|------ | =
|     c   |

My left,right barackets and  with my expressions inside, my question was
shoul I  draw my barackets first then write the expressions after or code as
I draw the brackets .

Please be free to make any corrections or re-write the whole thing!

Public Function RBracketW(Optional addHeight As Integer)
  Dim myPara As Object
  Dim xx As Integer

  On Error GoTo RBracketW_Error

   Set myPara = oWord.Selection.Paragraphs

With oWord.Selection
   oWord.Selection.Font.bold = False
   If addHeight <> 0 Then
       oWord.Selection.InsertSymbol CharacterNumber:=246, Font:="Symbol",
Unicode:=True
       oWord.Selection.TypeText vbCr
     '/For Each myPara In Selection.Paragraphs
         With myPara.Format
           For xx = 1 To addHeight
           .LineSpacingRule = wdLineSpaceExactly
           .LineSpacing = oWord.Selection.Range.Characters.First.Font.SIZE
oWord.Selection.InsertSymbol  CharacterNumber:=231,Font:="Symbol",
Unicode:=True
           oWord.Selection.TypeText vbCr
           Next xx
         End With
     '/Next myPara
     oWord.Selection.InsertSymbol CharacterNumber:=248, Font:="Symbol",
Unicode:=True
   Else
       'No additional height
       .InsertSymbol CharacterNumber:=246, Font:="Symbol", Unicode:=True
       .Paragraphs.Format.LineSpacingRule = wdLineSpaceExactly
       .Paragraphs.Format.LineSpacing =
oWord.Selection.Range.Characters.First.Font.SIZE
       oWord.Selection.TypeText vbCr
       .InsertSymbol CharacterNumber:=248, Font:="Symbol", Unicode:=True
   End If
   End With
   oWord.Selection.Font.bold = False

  On Error GoTo 0
  Exit Function

RBracketW_Error:

   MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RBracketW of Module qstrGen2"
   Resume Next
End Function

Regards

Kol

>> So I have the parentheses build say four or five symbols deep. How
>> do I navigate in otherwords, set the cursor position to each level from
[quoted text clipped - 40 lines]
> Regards,
> Klaus
Klaus Linke - 28 Mar 2008 03:48 GMT
I don't have time to look at the code right now...

If I had to do it with the Symbol font, I'd put tabs after the opening brace
characters, and before the closing brace... probably using a centered tab
for the stuff in between.

OTOH, it would likely be simpler to insert an equation using the equation
editor. It offers lots of different braces, and supports putting vectors or
matrices in them.

Greetings,
Klaus

> Hi Klaus;
>
[quoted text clipped - 65 lines]
>
> Kol
kol - 28 Mar 2008 13:37 GMT
Hi Klaus ;

I would like to use the equation editor; but honestly I don't know how.
If we go that way, don't even waste your time checking my code.
Instead, start me on using the equation editor thru vb6. If that is what you
have in your mind, I agree with you. It woud be a  nice and clean job
with many options.

Regards,

Kol

>I don't have time to look at the code right now...
>
[quoted text clipped - 79 lines]
>>
>> Kol
Klaus Linke - 28 Mar 2008 19:34 GMT
> I would like to use the equation editor; but honestly I don't know how.

I was thinking about creating the vector manually, not programatically.
You'd "Insert > Object", Microsoft Equation Editor 3.0

Then from the toolbar that pops up, insert round braces (bottom left on the
toolbar, first item in the popup),
1-column vector (bottom right... then middle of the last row in the popup --  
not directly a 1×3 vector, because the more general dialog for arbitrary
vectors gives you more options).
Enter "3" rows, then click between the elements to add the lines,
enter the vector elements a, b, c from your example,
format them in a proper style ("Vector"?) from the menu,
and you're done.

Microsoft has licensed the Equation Editor from MathType, which offers an
SDK for developpers.
I haven't ever tried it though, and don't know whether you could use it to
create the equation programmatically:
http://www.dessci.com/en/reference/sdk/

Maybe you could insert a nicely formatted vector programmatically as a Shape
(Drawing toolbar > AutoShapes, Type msoShapeDoubleBracket). If I come up
with some code, I'll post it... Or maybe somebody else has some code ready
and comes across this thread.

Greetings,
Klaus

> Hi Klaus ;
>
[quoted text clipped - 92 lines]
>>>
>>> Kol

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.