Change Default Unit from code

How can I change Default used Unit from c# code as it can be done for DefaultPaperSize?

Thank you in advance.

Comments

  • edited 1:07AM
    FastReport.ReportPage Page1 = new FastReport.ReportPage();
    Page1.Name = "Page1";
    Page1.PaperWidth = 215.9f;    // millimeter => 21.59 cm
    Page1.PaperHeight = 139.7f;    // millimeter => 13.97 cm
    Page1.LeftMargin = 20f;    // millimeter => 2 cm
    Page1.RightMargin = 20f;    // millimeter => 2 cm
    Page1.FirstPageSource = 15;    // automatically select
    Page1.OtherPagesSource = 15;    // automatically select
    
  • edited 1:07AM
    I mean that on UI in View menu there is a Units options and in View->Options->ReportPage.
    Is there way to change this option from code? (please see attachment)
  • edited February 2019
    >
    using (var report = new FastReport.Report())
    {
        using (var designer = new FastReport.Design.StandardDesigner.DesignerForm(false))
        {
            designer.ShowInTaskbar = true;
            designer.Designer.Report = report;
    
            var ribbon = designer.Controls[2] as FastReport.DevComponents.DotNetBar.RibbonControl;
            var panel = ribbon.Controls[3] as FastReport.DevComponents.DotNetBar.RibbonPanel;
            var bar = panel.Controls[0] as FastReport.DevComponents.DotNetBar.RibbonBar;
            var button = bar.Items[3] as FastReport.DevComponents.DotNetBar.ButtonItem;
            var buttonMilli = button.SubItems[0] as FastReport.DevComponents.DotNetBar.ButtonItem;
            var buttonCenti = button.SubItems[1] as FastReport.DevComponents.DotNetBar.ButtonItem;
            var buttonInch = button.SubItems[2] as FastReport.DevComponents.DotNetBar.ButtonItem;
            var buttonHundredOfInch = button.SubItems[3] as FastReport.DevComponents.DotNetBar.ButtonItem;
    
            // milli or centi or inch or hundred of inch
            buttonMilli.RaiseClick();
            //buttonCenti.RaiseClick();
            //buttonInch.RaiseClick();
            //buttonHundredOfInch.RaiseClick();
    
            designer.ShowDialog();
        }
    }
    

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.