How to set column sizes programatically?
I need to set from my code the column width for some messures.
I build the slice and set the column width for the Y-axe fields with this code:
fcSDatos.BeginUpdate;
fcSDatos.Clear;
fcSDatos.AddFieldTo('FSERVIR', 'fecha servir', rf_CapYAx);
fcSDatos.AddFieldTo('NOMBRE_LEGAL', 'cliente (nombre legal)', rf_CapYAx);
fcSDatos.AddFieldTo('TRANSPORTE', 'tipo de transporte', rf_CapYAx);
fcSDatos.AddFieldTo('M2', 'M2', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo('PESO', 'PESO BRUTO', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo('PALETSREALES', '# PALETS', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo(sMeasuresFieldName, '', rf_CapXAx);
fcsDatos.SliceFields.ItemByName.MakeTotal:=False;
fcsDatos.SliceFields.ItemByName.Width:=80;
fcsDatos.SliceFields.ItemByName.Width:=300;
fcsDatos.SliceFields.ItemByName.Width:=150;
fcSDatos.EndUpdate;
However, if I try to modify the width of any column set wihtin the messures field I have no effect:
fcsDatos.SliceFields.ItemByName.Width:=50;
Even if I do this, the width for the M2 field in the sets to the "DefaultColWidth" slice property.
Any help?
I build the slice and set the column width for the Y-axe fields with this code:
fcSDatos.BeginUpdate;
fcSDatos.Clear;
fcSDatos.AddFieldTo('FSERVIR', 'fecha servir', rf_CapYAx);
fcSDatos.AddFieldTo('NOMBRE_LEGAL', 'cliente (nombre legal)', rf_CapYAx);
fcSDatos.AddFieldTo('TRANSPORTE', 'tipo de transporte', rf_CapYAx);
fcSDatos.AddFieldTo('M2', 'M2', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo('PESO', 'PESO BRUTO', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo('PALETSREALES', '# PALETS', rf_CapFacts, af_Sum);
fcSDatos.AddFieldTo(sMeasuresFieldName, '', rf_CapXAx);
fcsDatos.SliceFields.ItemByName.MakeTotal:=False;
fcsDatos.SliceFields.ItemByName.Width:=80;
fcsDatos.SliceFields.ItemByName.Width:=300;
fcsDatos.SliceFields.ItemByName.Width:=150;
fcSDatos.EndUpdate;
However, if I try to modify the width of any column set wihtin the messures field I have no effect:
fcsDatos.SliceFields.ItemByName.Width:=50;
Even if I do this, the width for the M2 field in the sets to the "DefaultColWidth" slice property.
Any help?
Comments
You can not set column width in X axis using fcsDatos.SliceFields.ItemByName.Width.
Use to set column width in X axis use fcSDatos.XAxisColWidth[ACol] (use it after fcSDatos.EndUpdate).
ACol - visible index.
Oleg Pryalkov.