cancel
Showing results for 
Search instead for 
Did you mean: 

Change Font size in RichText Datawindow 1 column

Former Member
0 Kudos

Running PB 12.1  Classic.

Whatever I do; font size does not want to change in a Richtext presentation style external datawindow size of column = string 20000000 bytes

Why = long story - converting unix reports to PB for Archiving.

I do this after the only column is populated.  You can actually see all text

dw_1.SelectTextall()     Actualy selects ALL text in dw

I have tried to setColumn(1) returns -1

src = dw_1.Modify("a.Font.Height='-8'")      a = column name     Line 1  Column 15: incorrect syntax.

li_rtn = dw_1.SetRichTextSize(8)    li_rtn = -1

I could use 2 datawindows with different Font sizes but I would like to know how can I accomplish this with code.

Anything else works

src = "DataWindow.Print.Orientation='1'

src = dw_1.Modify("DataWindow.Print.PrinterName='Xerox Phaser 5500DX PS Tray 3'")

src = dw_1.Modify( "datawindow.print.preview=yes" )

ls_default_printname = dw_1.Object.DataWindow.Print.PrinterName

li_PageCount =  long ( dw_1.describe  ("evaluate('pagecount()'," + string ( dw_prt.rowcount() ) + ")"))

src = dw_1.Modify( "datawindow.print.preview=no" )

ls_page_range =dw_1.describe ( "DataWindow.Print.Page.Range" )

li_noCopies =  integer( dw_1.describe ("DataWindow.Print.Copies"))

src = "DataWindow.Print.Copies='" +String(astr_spool.copies)+"'"

src = dw_1.Modify( src )

src = "DataWindow.Print.duplex='" + String(astr_spool.duplex)+"'"

src = dw_1.Modify( src )

src = "DataWindow.Print.paper.Source='2'"

src = dw_1.Modify( src )

dw_1.Object.DataWindow.Print.PrinterName= 'Sybase Datawindow PS'

Accepted Solutions (1)

Accepted Solutions (1)

nayf
Participant
0 Kudos

Hi Luis,

The only thing I can think is maybe try removing the single quotes around -8. The error message indicates there is a problem with the 15th character, which is the position of the first '

Also, PB help indicates that Font.height is an integer, not a string, so shouldn't need the quotes ('An integer specifying the height of the text in the unit measure for the DataWindow').

Having said that, it works OK for me with and without quotes in PB 10.2.

Good luck,

Nathan

Former Member
0 Kudos

Hi Nathan,

Appreciate your answer,  the DataWindow Modify function as far as I know, all Numbers/integers must be specified using only SINGLE quote. Like src = " DataWindow.Print.Orientation='1'  "

Thank you

former_member202249
Active Participant
0 Kudos

Luis,

Is this rich text data?   With RichTextToolbarActivationEdit! set as the Rich Text Toolbar Activation Mode, does the default rich text toolbar come up and let you change the font size when you're editing it?

If you look at the usage for the SetRichTextSize method  it says this method is to be used on a customized font toolbar button.  I've actually never created one myself and haven't been able to find an example but it does not look like that's where your code is.

FYI, remember the rich text control in PB 10.2 is a different control than in PB 12.1, so code that worked in PB 10.2 does not always work in later versions.

Pat

nayf
Participant
0 Kudos

Luis,

Not according to the examples in PB help under the Controls in a DataWindow and their properties section. While there are no specific examples for Font.Height, there are for other properties expecting numeric values

ie (copied from PB help) -

dw_1.Modify("emp_name.X=10")

dw_1.Modify("empname.Height=50")

dw_1.Modify("emp_stat.Protect=1")

dw_1.Modify("DataWindow.Print.Margin.Top=500")

etc


None of the examples I've seen use quotes around the property value where the value is expected to be numeric.

Although, like I said, I've seen Modifys using numeric arguments work both with and without quotes.

The setColumn(1) returning -1 is a concern. Seems to indicate there's something fishy going on ... wonder what happens if you try SetColumn with the column name. What event/function is this code executing from?

Nathan

Former Member
0 Kudos

Hi Pat,

Yes it is rich text. basically, this is a batch process, the user never sees this datawindow. In summary, unix sends all these report flat files to a dir.  I have a small powerbuilder program that wakes every 5 minutes and check for files in the dir. the app opens file reads into a blob/string, then dw presentation style richtext has 1 column. the blob/string is loaded into the column. Here is where I need to change the size of the font.

If the rep is landscape, the one column font size needs to be 8 otherwise portrait is 9. 

Right now I am using 2 datawindows with Verdana which is better than Courier New, one with font 8 and one with font 9.  But knowing the user, eventually they will want different variations.

Thank you

Luis

former_member202249
Active Participant
0 Kudos

Hi Luis,

Unfortunately font properties including textsize when using a rich text datawindow (or control)  are only able to be changed in the painter or with the rich text toolbar, not in a batch mode.


Luckily it sounds like you have a workaround.


Pat

Former Member
0 Kudos

Thanks

Answers (0)