How to hide StiBarCode in code?

Stimulsoft Reports.WEB discussion
Post Reply
MartinB
Posts: 15
Joined: Wed May 02, 2012 11:02 am

How to hide StiBarCode in code?

Post by MartinB »

Hi,

I am creating a label report in code and want to hide an StiBarCode object if there is no data for the barcode. The StiBarCode object is added to an StiPanel object which has a condition that sets the Enabled property to false if a particular data field is null

e.g.

Code: Select all

StiPanel objLabelArea = new StiPanel(new RectangleD(0, 0, Math.Round(LabelDefinition.Style.LabelStyle_LabelWidth, 2), Math.Round(LabelDefinition.Style.LabelStyle_LabelHeight, 2)));
objLabelArea.Name = "LabelArea";
objLabelArea.Conditions.Add(new StiCondition() { Column = strID, Condition = StiFilterCondition.EqualTo, DataType = StiFilterDataType.Expression, Value1 = "null", Enabled = false });
objDataBand.Components.Add(objLabelArea);
This works fine for the StiPanel and any other objects added to it (e.g. StiText and StiImage objects), apart from the StiBarCode object.
I have also tried to add a similar condition directly to the StiBarCode object, but that does not work either.

e.g.

Code: Select all

strFldName = "{" + String.Format("{0}.Barcode", LabelsView.Table.ToString()) + "}";
objBarcode = new StiBarCode(new RectangleD(x, y, w, h))
{
    AutoScale = true,
    BarCodeType = new StiCode39ExtBarCodeType(13F, 1F, 2.2F, StiCheckSum.No),
    Code = new StiBarCodeExpression(strFldName),
    HorAlignment = ReportHelper.AlignmentToStiAlignment(objItem.LabelItem_Alignment),
    Name = strName
};
objBarcode.Conditions.Add(new StiCondition() { Column = strID, Condition = StiFilterCondition.EqualTo, DataType = StiFilterDataType.Expression, Value1 = "null", Enabled = false });
objLabelArea.Components.Add(objBarcode);
How can I hide the barcode when the source data field is empty?

Thanks, Martin.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to hide StiBarCode in code?

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduces the issue for analysis.

Thank you.
Post Reply