I'd like to take this buffer:
myBuffer=richTextWithOle o.ALongText
...and append my own text at the end, but in a smaller font size (and bold).
Does anyone have an idea of how to do this, or how difficult it might be?
(My experiments to date have not proved fruitful, but I really know very little about RTF markup; trying to learn!)
Regards, Strathglass.
strathglass - Fri May 15 11:10:39 EDT 2009 |
|
Re: Changing font size of rich text buffer possible? Ron_Lewis - Fri May 15 12:45:57 EDT 2009
I would suggest that you don't go very far down this path. If you start playing with font sizes you work load increases and benefits are small. However if you must persist you can change layoutdxl fonts and this is address in old forum. But after doing the work you might find the pain generated is to great.
|
|
Re: Changing font size of rich text buffer possible? strathglass - Fri May 15 14:46:46 EDT 2009 Ron_Lewis - Fri May 15 12:45:57 EDT 2009
I would suggest that you don't go very far down this path. If you start playing with font sizes you work load increases and benefits are small. However if you must persist you can change layoutdxl fonts and this is address in old forum. But after doing the work you might find the pain generated is to great.
Thanks Ron.
What I am actually trying to do is format a Word output report by modifying the Word.dxl script (or else maybe the RTF export script, which I haven't looked at).
I simply want to append to the object text of the exported objects the values of certain other attributes IN THE WORD OUTPUT.
(I don't need to modify anything in DOORS).
With this clarification, is there any easy option to do this?
Regards,
Colin
|
|
Re: Changing font size of rich text buffer possible? Ron_Lewis - Fri May 15 15:13:10 EDT 2009 strathglass - Fri May 15 14:46:46 EDT 2009
Thanks Ron.
What I am actually trying to do is format a Word output report by modifying the Word.dxl script (or else maybe the RTF export script, which I haven't looked at).
I simply want to append to the object text of the exported objects the values of certain other attributes IN THE WORD OUTPUT.
(I don't need to modify anything in DOORS).
With this clarification, is there any easy option to do this?
Regards,
Colin
If you export a view in book format the attributes are appended. You may want to write a vba script to remove column headers are unacceptable to your needs.
|
|
Re: Changing font size of rich text buffer possible? strathglass - Fri May 15 15:30:29 EDT 2009 Ron_Lewis - Fri May 15 15:13:10 EDT 2009
If you export a view in book format the attributes are appended. You may want to write a vba script to remove column headers are unacceptable to your needs.
I'd definitely rather do it in DXL if I could, rather than VBA.
Regards, Strathglass.
|
|
Re: Changing font size of rich text buffer possible? djakad - Mon May 18 16:49:12 EDT 2009 strathglass - Fri May 15 15:30:29 EDT 2009
I'd definitely rather do it in DXL if I could, rather than VBA.
Regards, Strathglass.
The size of text in Rich Text is controlled by the "font size" tag, or \fsXX, where XX is the size of the font you want.
Here is a sample Rich Text string:
{\rtf1\ansi\ansicpg936\deff0{\fonttbl{\f0\froman\fcharset0 Times New Roman;}}
\f0\fs8 Hello Small World\par
\fs48 Hello Large World\par
}
So, you should be able to append to your buffer with something like:
mySmallNote = "Hello Small World"
myBuffer += "\\fs8 " mySmallNote
(I thing you have to escape the backslash)
Be aware that you will only see the font size difference in Word. Dialog box elements, such as richField and richText, automatically strip out all font size tags to force a standard-size font in these DBEs.
Also, good luck fussing with the Word exporter script. I fount it to be pretty cryptic.
|
|
Re: Changing font size of rich text buffer possible? strathglass - Wed May 20 09:55:15 EDT 2009 djakad - Mon May 18 16:49:12 EDT 2009
The size of text in Rich Text is controlled by the "font size" tag, or \fsXX, where XX is the size of the font you want.
Here is a sample Rich Text string:
{\rtf1\ansi\ansicpg936\deff0{\fonttbl{\f0\froman\fcharset0 Times New Roman;}}
\f0\fs8 Hello Small World\par
\fs48 Hello Large World\par
}
So, you should be able to append to your buffer with something like:
mySmallNote = "Hello Small World"
myBuffer += "\\fs8 " mySmallNote
(I thing you have to escape the backslash)
Be aware that you will only see the font size difference in Word. Dialog box elements, such as richField and richText, automatically strip out all font size tags to force a standard-size font in these DBEs.
Also, good luck fussing with the Word exporter script. I fount it to be pretty cryptic.
Thanks. I thought I had tried that with no luck (when I was just guessing!).
But I will go play with that again to see if I can get it functioning.
If I get it working I'll post an update.
(FYI I think the \fsXX may imply the font size in half points, so \fs16 would give 8 point font.)
-Strathglass
|
|
Re: Changing font size of rich text buffer possible? Tippers - Wed May 20 10:41:18 EDT 2009 strathglass - Wed May 20 09:55:15 EDT 2009
Thanks. I thought I had tried that with no luck (when I was just guessing!).
But I will go play with that again to see if I can get it functioning.
If I get it working I'll post an update.
(FYI I think the \fsXX may imply the font size in half points, so \fs16 would give 8 point font.)
-Strathglass
I'd suggest exporting your module to RTF, adding the text (and formatting) you want manually, resaving as RTF, and checking what Word has done to the document. That way, you get to see what changes you need in the RTF. That's how I worked out most of the RTF I needed for my exporter -- that and reading Microsoft's web site...
Paul
PS I'm pretty sure the XX in \fsXX is the actual font size.
|
|
Re: Changing font size of rich text buffer possible? Tony_Goodman - Thu May 21 02:48:32 EDT 2009 Tippers - Wed May 20 10:41:18 EDT 2009
I'd suggest exporting your module to RTF, adding the text (and formatting) you want manually, resaving as RTF, and checking what Word has done to the document. That way, you get to see what changes you need in the RTF. That's how I worked out most of the RTF I needed for my exporter -- that and reading Microsoft's web site...
Paul
PS I'm pretty sure the XX in \fsXX is the actual font size.
That's a good tip Paul, and in fact is the way I figured out RTF markup too.
I would however recommend using Wordpad rather than Word so you don't get all the "noise" that Word generates.
|
|
Re: Changing font size of rich text buffer possible? Tony_Goodman - Thu May 21 03:00:03 EDT 2009 Tony_Goodman - Thu May 21 02:48:32 EDT 2009
That's a good tip Paul, and in fact is the way I figured out RTF markup too.
I would however recommend using Wordpad rather than Word so you don't get all the "noise" that Word generates.
My testing shows that the font size is half that shown in the RTF markup.
So fs20 gives a font size of 10 points. I presume this is to allow half points to be defined without using a decimal point.
|
|
Re: Changing font size of rich text buffer possible? Tippers - Thu May 21 03:28:16 EDT 2009 Tony_Goodman - Thu May 21 03:00:03 EDT 2009
My testing shows that the font size is half that shown in the RTF markup.
So fs20 gives a font size of 10 points. I presume this is to allow half points to be defined without using a decimal point.
My apologies. You're quite right, the font size displayed is half the font size in the /fsXX. My exporter even has the (correct!) arithmetic in it to double the requested font size so it appears correctly in the RTF. I guess that's the down side of (a) getting older and (b) having written the thing so long ago now :(
BTW, thanks for the tip about WordPad. Word really chews up the RTF I create!
|
|
Re: Changing font size of rich text buffer possible? llandale - Thu May 21 11:27:23 EDT 2009 Tippers - Thu May 21 03:28:16 EDT 2009
My apologies. You're quite right, the font size displayed is half the font size in the /fsXX. My exporter even has the (correct!) arithmetic in it to double the requested font size so it appears correctly in the RTF. I guess that's the down side of (a) getting older and (b) having written the thing so long ago now :(
BTW, thanks for the tip about WordPad. Word really chews up the RTF I create!
That's the second time you've made that 'getting older' remark.
|
|
Re: Changing font size of rich text buffer possible? Tippers - Thu May 21 11:32:54 EDT 2009 llandale - Thu May 21 11:27:23 EDT 2009
That's the second time you've made that 'getting older' remark.
There's a reason for that, but I believe you chaps from the other side of the pond have an expression along the lines of "Three strikes and you're out", so I'll not mention it again. Well, not yet anyway...
Paul
|
|