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?

Comments

  • edited 1:23PM
    Hi.

    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.
  • Many thanks Oleg, it worked like a charm!!
    wrote: »
    Hi.

    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.