Combine Variables in RichBox

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Combine Variables in RichBox

Post by Safeware » Thu Dec 17, 2009 5:03 pm

I should put to label text with charLength more then 4096 and source get from variable (variables)
It can do if use RichBox with combine some variables on RichText Editor: [var1][var2][var3].
Can I add to RichText these variables [var1][var2][var3] in .Net programm?

var rtf = (IRTFText) LabelIntf.Objects.Item(1);
rtf.Variable.SetValue("...") not working
rtf.Variable.SetContent ("...") not working too

Or maybe there are other way?

Thanks

User avatar
jurk
Addict
Addict
Posts: 175
Joined: Wed Sep 27, 2006 1:10 pm
Location: Sencur, Slovenija
Contact:

Re: Combine Variables in RichBox

Post by jurk » Fri Dec 18, 2009 2:08 pm

When you combine variables in a RTF you are using variables that are part of the label.

The rtv.Variable member is the result of combination of the variables you specified in a RTF (var1, var2, var3).

So what you need to do is go over Label.Variables, find var1, var2 and var3 and set those.
NiceLabel Development

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Mon Dec 21, 2009 12:52 pm

Is it possible to combine multiple variables (var1, var2, var3) in rtv.Variable in an RTF object programmatically thru SDK?

User avatar
jurk
Addict
Addict
Posts: 175
Joined: Wed Sep 27, 2006 1:10 pm
Location: Sencur, Slovenija
Contact:

Re: Combine Variables in RichBox

Post by jurk » Mon Dec 21, 2009 2:44 pm

This cannot be done because rtf.Variable and var1 and var2 are of instance IVar.

You can only design a label, put two variables on the label (called var1 and var2) and add them as contents into the RTF object like so

Code: Select all

[var1][var2]
And then set those two variables with 2x4096 of data. The result will be a rtf text with 8k of data.
NiceLabel Development

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Mon Dec 21, 2009 2:52 pm

Can we add variables on the label as contents into an RTF object programmatically? Just sometimes we want an RTF object contain variables var1 and var2, and sometimes var3 and var4...

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Thu Jan 07, 2010 11:16 am

any chance of an update on this?

User avatar
jurk
Addict
Addict
Posts: 175
Joined: Wed Sep 27, 2006 1:10 pm
Location: Sencur, Slovenija
Contact:

Re: Combine Variables in RichBox

Post by jurk » Fri Jan 08, 2010 11:51 am

Sorry for the delay, new year and holidays made it hard to do so :)

You cannot do this in the way you would like to, what you could do is add two RTF objects and use ActiveX to show/hide the one you want to print...
NiceLabel Development

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Tue Jan 12, 2010 9:53 am

Hi there

the problem is that we do not know until printtime which box will require more than 4096 characters (this entire issue arises from Nicelabels inability to display more than 4096 chars per variable).

We cannot expect the user to know when designing which variable may hit 4096 at some time and wanted to add a programmatic solution to this .

Are there any other solutions that you can think of (short of fixing variables in nicelabel :D )?

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: Combine Variables in RichBox

Post by Saso » Tue Jan 12, 2010 11:26 am

Try this:
  • Think about how much text you need in the RTF object. The maximum number of characters...
  • Define that many variables, var1, var2, etc. Each variable contains max. 4096 characters.
    E.g. if you need to encode 15000 characters, you need 4 variables.
  • Create the RTF object on the label. Add all created variables to the RTF contents (use built-in Rich Text editor).
    forum-RTF-editor.png
    forum-RTF-editor.png (29.4 KiB) Viewed 7243 times
  • Your application will distribute the user data into 4096-character chunks and store them to variables.
  • For 15000 incoming characters, var1 to var3 will have 4096 characters of data, var4 will have the remaining 2712 characters.
  • If you will have only 300 characters to encode, you will fill all data to var1, leaving var2, var3 and var4 empty.
Problem solved?
Saso Fleiser
Senior Technical Product Specialist

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Tue Jan 12, 2010 11:36 am

Hi Saso,

The problem with this is it will require our user to have the knowledge to include [Var1][Var2][Var3] etc when they create a rich text field within a label. Also realistically this will cause us support problems as a user will not understand why they need to do this for some variables but not for others

There is no way for us to tell what variables may "overspill from 4096" as potentally any of them can as we query them from a database - this is why we wanted to fix this programatically somehow.

The solution you propose is the one I wanted to use, except we wanted to do this programatically

so User designs label with [var] in Rich text editor

and on print we detect size of var and split accordingly into

[var][var1][var2] etc... so that we can always fit.

Gregg

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: Combine Variables in RichBox

Post by Saso » Tue Jan 12, 2010 12:09 pm

Hi Gregg,

Aha, I understand.
I presumed you will design the labels for the user, not letting them see the label designer...

What Jurk and I suggested might be the only way out with the current NiceLabel.

These are not 'standard' types of the labels you want to print, aren't they? It looks like you are printing documents of some kind and not labels?
Saso Fleiser
Senior Technical Product Specialist

Safeware
Valued Contributor
Posts: 35
Joined: Wed Dec 16, 2009 1:46 pm

Re: Combine Variables in RichBox

Post by Safeware » Tue Jan 12, 2010 12:16 pm

We do indeed let the user design their own label - but we prepopulate the variables using a wizard which the user selects what they require in.

The labels we are printing are Standard GHS labels which will be industry standard as of 2015.

Currently labels use Risk phrases which are superceded by Hazard Statements and Safety Phrases which are superceded by Precautionary statements.

The new statements contain a LOT more text than the old ones and so if this isnt resolved Nicelabel will be unsuitable for use in chemical labelling by anyone!

if you see pages 5\6 of the following document http://www.safeware.co.uk/pdf/Chip4_regulations.pdf you will the type of label we are producing - this can also be multilingual which extends the size greatly.

I will have our guys investigate potential third party solutions - is there anything planned for nicelabel which may provide a nicer fix this in future?

Gregg

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: Combine Variables in RichBox

Post by Saso » Wed Jan 13, 2010 3:55 pm

Gregg,

Actually, there is a way to overcome the 4096-characters limitation.

If you define the variable inside the user interface, you are limited by 4096 characters. However, there is no limitation if you set the variable length from your application using ActiveX interface. This could be a workaround for providing veeery large content to the variable.

We have tested this approach with the variable with 20000 and more characters linked with the Text Box (with Best Fit option enabled).

The user can define his variable var1 with 4096 characters, and you can programmable increase its length just before you assign it with long value.

See the Programming Guide for the 'length' property for the variables.

This suggestion should solve the problem for now, but should be treated as 'unsupported'.
In the future versions of NiceLabel software we have to deal with the 4096 limitation also in the NiceLabel Pro itself (and other application in the Suite edition).
Saso Fleiser
Senior Technical Product Specialist

Post Reply