AW: Bold in printing
Rudolf Bargholz
rudolf at bargholz.ch
Thu Aug 2 06:02:42 EDT 2018
Hi Wendy,
My solution takes into account, that in a text background object in a report you can print bold, italic or underline text.
I create a text variable in the report, then add a text background object to the report with the contents "[MyVariable]" with $vertextend=kTrue. This will print just like a normal entry field on the report. The trick is to have a positioning after the field, which allows the field to print over many lines, taking into account page breaks, and a positioning section before the field. I override the $print in the before-positioning:
Calculate ItemInfoLabelText as iItemInfoText
Do lStringFuncObj.$convertStringToLabelText(ItemInfoLabelText)
Do default
The $convertStringToLabelText does the following to the field reference variable that is passed it from the report:
If pos('<p>',pfString)>0
Calculate pfString as replaceall(pfString,'<p>',chr(13,10))
End If
If pos('<p/>',pfString)>0
Calculate pfString as replaceall(pfString,'<p/>',chr(13,10))
End If
If pos('<p />',pfString)>0
Calculate pfString as replaceall(pfString,'<p />',chr(13,10))
End If
If pos('<P>',pfString)>0
Calculate pfString as replaceall(pfString,'<P>',chr(13,10))
End If
If pos('<P/>',pfString)>0
Calculate pfString as replaceall(pfString,'<P/>',chr(13,10))
End If
If pos('<P />',pfString)>0
Calculate pfString as replaceall(pfString,'<P />',chr(13,10))
End If
If pos('<b>',pfString)>0
Calculate pfString as replaceall(pfString,'<b>',l_Bold)
End If
If pos('<i>',pfString)>0
Calculate pfString as replaceall(pfString,'<i>',l_Italic)
End If
If pos('<u>',pfString)>0
Calculate pfString as replaceall(pfString,'<u>',l_Underline)
End If
If pos('<bi>',pfString)>0
Calculate pfString as replaceall(pfString,'<bi>',l_BoldItalic)
End If
If pos('<ib>',pfString)>0
Calculate pfString as replaceall(pfString,'<ib>',l_BoldItalic)
End If
If pos('<bu>',pfString)>0
Calculate pfString as replaceall(pfString,'<bu>',l_BoldUnderline)
End If
If pos('<ub>',pfString)>0
Calculate pfString as replaceall(pfString,'<ub>',l_BoldUnderline)
End If
If pos('<ui>',pfString)>0
Calculate pfString as replaceall(pfString,'<ui>',l_ItalicUnderline)
End If
If pos('<iu>',pfString)>0
Calculate pfString as replaceall(pfString,'<iu>',l_ItalicUnderline)
End If
If pos('<biu>',pfString)>0
Calculate pfString as replaceall(pfString,'<biu>',l_BoldItalicUnderline)
End If
If pos('<bui>',pfString)>0
Calculate pfString as replaceall(pfString,'<bui>',l_BoldItalicUnderline)
End If
If pos('<ubi>',pfString)>0
Calculate pfString as replaceall(pfString,'<ubi>',l_BoldItalicUnderline)
End If
If pos('<uib>',pfString)>0
Calculate pfString as replaceall(pfString,'<uib>',l_BoldItalicUnderline)
End If
If pos('<iub>',pfString)>0
Calculate pfString as replaceall(pfString,'<iub>',l_BoldItalicUnderline)
End If
If pos('<ibu>',pfString)>0
Calculate pfString as replaceall(pfString,'<ibu>',l_BoldItalicUnderline)
End If
If pos('</b>',pfString)>0
Calculate pfString as replaceall(pfString,'</b>',l_Normal)
End If
If pos('</i>',pfString)>0
Calculate pfString as replaceall(pfString,'</i>',l_Normal)
End If
If pos('</u>',pfString)>0
Calculate pfString as replaceall(pfString,'</u>',l_Normal)
End If
If pos('</bi>',pfString)>0
Calculate pfString as replaceall(pfString,'</bi>',l_Normal)
End If
If pos('</ib>',pfString)>0
Calculate pfString as replaceall(pfString,'</ib>',l_BoldItalic)
End If
If pos('</bu>',pfString)>0
Calculate pfString as replaceall(pfString,'</bu>',l_Normal)
End If
If pos('</ub>',pfString)>0
Calculate pfString as replaceall(pfString,'</ub>',l_Normal)
End If
If pos('</ui>',pfString)>0
Calculate pfString as replaceall(pfString,'</ui>',l_Normal)
End If
If pos('</iu>',pfString)>0
Calculate pfString as replaceall(pfString,'</iu>',l_Normal)
End If
If pos('</biu>',pfString)>0
Calculate pfString as replaceall(pfString,'</biu>',l_Normal)
End If
If pos('</bui>',pfString)>0
Calculate pfString as replaceall(pfString,'</bui>',l_Normal)
End If
If pos('</ubi>',pfString)>0
Calculate pfString as replaceall(pfString,'</ubi>',l_Normal)
End If
If pos('</uib>',pfString)>0
Calculate pfString as replaceall(pfString,'</uib>',l_Normal)
End If
If pos('</iub>',pfString)>0
Calculate pfString as replaceall(pfString,'</iub>',l_Normal)
End If
If pos('</ibu>',pfString)>0
Calculate pfString as replaceall(pfString,'</ibu>',l_Normal)
End If
Each variable, e.g. "l_Normal " is associated with a value:
l_Bold binfromhex('1B02303030303030303123')
l_BoldItalic binfromhex('1B02303030303030303323')
l_BoldItalicUnderline binfromhex('1B02303030303030303723')
l_BoldUnderline binfromhex('1B02303030303030303523')
l_Italic binfromhex('1B02303030303030303223')
l_ItalicUnderline binfromhex('1B02303030303030303623')
l_Normal binfromhex('1B02303030303030303023')
l_Underline binfromhex('1B02303030303030303423')
This emulates what happens when you manually enter text into a text background report object on the report.
The users can then enter a text
Abc<b>DEF</b>ghi
And the DEF will be printed in bold on the report.
Regards
Rudolf Bargholz
-----Ursprüngliche Nachricht-----
Von: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von Wendy
Gesendet: Donnerstag, 2. August 2018 09:02
An: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
Betreff: Bold in printing
Hi
I want the user to be able to bold text in a document - I am sure that this worked some years ago but does not work any more - I am hoping someone can help.
The user can put [kbold] at the start of the text to bold and [kplain] at the end , they can also put [knewline] - I then replace these with the characters required - this works fine for the new line but not the bold.
The characters I am using are
Library variable GV_BOLD (Character 2) = con(chr(14),chr(2))
Library variable GV_NORMAL (Character 2) = con(chr(14),chr(1))
Library variable GV_NEWLINE (Character 1) = chr(13)
What am I doing wrong?
Many thanks for your help
Wendy Osbaldestin
Wizard Computer Services
Tel: 01260271647
Mobile: 07740541021
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list