Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
when print a grid unit got lost in print document , need a solution ASAP
posted

In Ultragrid, we have applying editor at column level,. In ediotr we are dividing the value by units like 10, 100, 1000, 1000000 in method Presenter.GetDisplayUnitValue().

We are able to see the correct result in the grid but while printing units are getting lost, only formatting is there . For example In grid it is showing 3,574 but in printing it is showing 3,574, 117,511. It should display the same result.Below is the code snippet

IntializeLayout()

column.Editor.DataFilter = new UnitEditorDataFilter() { Presenter = m_presenter };

column.Format = "#,###;-#,###"

Editor Code:

public class UnitEditorDataFilter : IEditorDataFilter

object IEditorDataFilter.Convert(Infragistics.Win.EditorDataFilterConvertArgs args)

{

double d;

UltraGridCell cell = args.Context as UltraGridCell;

if (double.TryParse(args.Value.ToString(), out d) && cell.Column.Header.Caption.Contains('/'))

{

switch (args.Direction)

{

case ConversionDirection.EditorToDisplay:

args.Handled = true;

if (args.Value.ToString() == "0")

return string.Empty;

else

return (System.Math.Floor(System.Convert.ToDouble(args.Value) / Presenter.GetDisplayUnitValue())).ToString("#,###;-#,###");

case ConversionDirection.DisplayToEditor:

args.Handled = true;

return (System.Convert.ToDouble(args.Value) * Presenter.GetDisplayUnitValue()).ToString();

}}}

Print Code: we are using

PrintDocument pd.print (gridname)

Thanks

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    When you print the grid, the DisplayLayout is cloned and the cloned layout is used for printing. This allows you to change the print layout without affect the on-screen layout. So my guess is that the Print layout is unable to clone the editor or the data filter, and so it's lost.

    See if the IntializeLayout event is getting called when you print. If not, then you may need to handle the InitializePrint event of the grid and set the Editor and/or DataFilter just like you are doing in the InitializeLayout.

Children
No Data