/**
     * Copy constructor
     */
    public Box(Box b)
    {
        this.marginTop = b.marginTop;
        this.marginTypeTop = b.marginTypeTop;
        this.marginRight = b.marginRight;
        this.marginTypeRight = b.marginTypeRight;
        this.marginLeft = b.marginLeft;
        this.marginTypeLeft = b.marginTypeLeft;
        this.marginBottom = b.marginBottom;
        this.marginTypeBottom = b.marginTypeBottom;

        this.width = b.width;
        this.height = b.height;
        this.widthType = b.widthType;
        this.heightType = b.heightType;
    }
Esempio n. 2
0
        /**
         * Gets the size of the margin in inches.
         *
         * @param margin which margin to get
         * @return the size of the margin
         * @see Sheet#LeftMargin
         * @see Sheet#RightMargin
         * @see Sheet#TopMargin
         * @see Sheet#BottomMargin
         * @see Sheet#HeaderMargin
         * @see Sheet#FooterMargin
         */
        public double GetMargin(MarginType margin)
        {
            if (!worksheet.IsSetPageMargins()) return 0;

            CT_PageMargins pageMargins = worksheet.pageMargins;
            switch (margin)
            {
                case MarginType.LeftMargin:
                    return pageMargins.left;
                case MarginType.RightMargin:
                    return pageMargins.right;
                case MarginType.TopMargin:
                    return pageMargins.top;
                case MarginType.BottomMargin:
                    return pageMargins.bottom;
                case MarginType.HeaderMargin:
                    return pageMargins.header;
                case MarginType.FooterMargin:
                    return pageMargins.footer;
                default:
                    throw new ArgumentException("Unknown margin constant:  " + margin);
            }
        }
    /**
     * Set the value of the Margin Top to "auto" or to a pixel value.
     */
    public Box SetMarginTop(string margin)
    {
        float width = INVALID;

        if (margin.ToLower().Equals("auto"))
        {
            this.marginTypeTop = MarginType.AUTO;
            this.marginTop = width;
        }
        else
        {
            string[] marginPx = Regex.Split(margin, @"\D+");

            if (marginPx.Length > 0)
            {

                float.TryParse(marginPx[0], out width);

                this.marginTypeTop = MarginType.PIXEL;
                this.marginTop = width;
            }

        }

        return this;
    }
Esempio n. 4
0
 public MarginComboItem(string text, MarginType type)
 {
     _text = text;
     _type = type;
 }
    /**
     * Set the value of the Margin Top to a percentage.
     */
    public Box SetMarginTop(float percentage)
    {
        this.marginTypeTop = MarginType.PERCENTAGE;
        this.marginTop = percentage;

        return this;
    }
Esempio n. 6
0
 private IMargin GetMarginRec(MarginType margin)
 {
     switch (margin)
     {
         case MarginType.LeftMargin: return _leftMargin;
         case MarginType.RightMargin: return _rightMargin;
         case MarginType.TopMargin: return _topMargin;
         case MarginType.BottomMargin: return _bottomMargin;
         default:
             throw new InvalidOperationException("Unknown margin constant:  " + (short)margin);
     }
 }
Esempio n. 7
0
 /**
  * Sets the size of the margin in inches.
  * @param margin which margin to Get
  * @param size the size of the margin
  */
 public void SetMargin(MarginType margin, double size)
 {
     IMargin m = GetMarginRec(margin);
     if (m == null)
     {
         switch (margin)
         {
             case MarginType.LeftMargin:
                 _leftMargin = new LeftMarginRecord();
                 m = _leftMargin;
                 break;
             case MarginType.RightMargin:
                 _rightMargin = new RightMarginRecord();
                 m = _rightMargin;
                 break;
             case MarginType.TopMargin:
                 _topMargin = new TopMarginRecord();
                 m = _topMargin;
                 break;
             case MarginType.BottomMargin:
                 _bottomMargin = new BottomMarginRecord();
                 m = _bottomMargin;
                 break;
             default:
                 throw new InvalidOperationException("Unknown margin constant:  " + margin);
         }
     }
     m.Margin = size;
 }
Esempio n. 8
0
 double ISheet.GetMargin(MarginType margin)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 9
0
 void ISheet.SetMargin(MarginType margin, double size)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 10
0
 void ISheet.SetMargin(MarginType margin, double size)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 11
0
 /// <summary>
 /// Set leverage and margin options for the given currency and/or symbol.
 /// </summary>
 /// <param name="symbol">Symbol name, i.e. "BTC-USD-SWAP"</param>
 /// <param name="margin">Margin type, i.e., Cross of Fixed (isolated)</param>
 /// <param name="leverage">Leverage ratio</param>
 public void SetLeverage(string symbol, MarginType margin, double leverage)
 => SetLeverageAsync(symbol, margin, leverage).Wait();
Esempio n. 12
0
 double ISheet.GetMargin(MarginType margin)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 13
0
 public double GetMargin(MarginType margin)
 {
     return(_sh.GetMargin(margin));
 }
Esempio n. 14
0
 public void SetMargin(MarginType margin, double size)
 {
     _sh.SetMargin(margin, size);
 }
Esempio n. 15
0
 /**
  * Sets the size of the margin in inches.
  *
  * @param margin which margin to get
  * @param size the size of the margin
  * @see Sheet#LeftMargin
  * @see Sheet#RightMargin
  * @see Sheet#TopMargin
  * @see Sheet#BottomMargin
  * @see Sheet#HeaderMargin
  * @see Sheet#FooterMargin
  */
 public void SetMargin(MarginType margin, double size)
 {
     CT_PageMargins pageMargins = worksheet.IsSetPageMargins() ?
             worksheet.pageMargins : worksheet.AddNewPageMargins();
     switch (margin)
     {
         case MarginType.LeftMargin:
             pageMargins.left = (size);
             break;
         case MarginType.RightMargin:
             pageMargins.right = (size);
             break;
         case MarginType.TopMargin:
             pageMargins.top = (size);
             break;
         case MarginType.BottomMargin:
             pageMargins.bottom = (size);
             break;
         case MarginType.HeaderMargin:
             pageMargins.header = (size);
             break;
         case MarginType.FooterMargin:
             pageMargins.footer = (size);
             break;
         default:
             throw new InvalidOperationException("Unknown margin constant:  " + margin);
     }
 }
    /**
     * Set the value of the Margin Bottom to a percentage.
     */
    public Box SetMarginBottom(float percentage)
    {
        this.marginTypeBottom = MarginType.PERCENTAGE;
        this.marginBottom = percentage;

        return this;
    }
Esempio n. 17
0
 public void SetMarginType(int margin, MarginType marginType)
 {
     this.SendMessageDirect(2240, margin, (int)marginType);
 }
    /**
     * Set the value of the Margin Bottom to "auto" or to a pixel value.
     */
    public Box SetMarginBottom(string margin)
    {
        float height = INVALID;

        if (margin.ToLower().Equals("auto"))
        {
            this.marginTypeBottom = MarginType.AUTO;
            this.marginBottom = height;
        }
        else
        {
            string[] marginPx = Regex.Split(margin, @"\D+");

            if (marginPx.Length > 0)
            {

                float.TryParse(marginPx[0], out height);

                this.marginTypeBottom = MarginType.PIXEL;
                this.marginBottom = height;
            }

        }

        return this;
    }
Esempio n. 19
0
 /**
  * Gets the size of the margin in inches.
  * @param margin which margin to Get
  * @return the size of the margin
  */
 public double GetMargin(MarginType margin)
 {
     IMargin m = GetMarginRec(margin);
     if (m != null)
     {
         return m.Margin;
     }
     else
     {
         switch (margin)
         {
             case MarginType.LeftMargin:
                 return .7;
             case MarginType.RightMargin:
                 return .7;
             case MarginType.TopMargin:
                 return .75;
             case MarginType.BottomMargin:
                 return .75;
         }
         throw new InvalidOperationException("Unknown margin constant:  " + margin);
     }
 }
    /**
     * Set the value of the Margin Right to a percentage.
     */
    public Box SetMarginRight(float percentage)
    {
        this.marginTypeRight = MarginType.PERCENTAGE;
        this.marginRight = percentage;

        return this;
    }
Esempio n. 21
0
 private static IMargin CreateMarginRecord(MarginType margin, double size)
 {
     IMargin m;
     switch (margin)
     {
         case MarginType.LeftMargin:
             m = new LeftMarginRecord();
             break;
         case MarginType.RightMargin:
             m = new RightMarginRecord();
             break;
         case MarginType.TopMargin:
             m = new TopMarginRecord();
             break;
         case MarginType.BottomMargin:
             m = new BottomMarginRecord();
             break;
         default:
             throw new InvalidOperationException("Unknown margin constant:  " + margin);
     }
     m.Margin = size;
     return m;
 }
Esempio n. 22
0
 public void SetMarginType(int margin, MarginType marginType)
 {
     this.SendMessageDirect(2240, margin, (int)marginType);
 }