Exemplo n.º 1
0
        /// <summary>
        /// Calculates the height of a client anchor in points.
        /// </summary>
        /// <param name="sheet">the sheet the anchor will be attached to</param>
        /// <returns>the shape height.</returns>
        public float GetAnchorHeightInPoints(Zephyr.Utils.NPOI.SS.UserModel.ISheet sheet)
        {
            int y1   = Dy1;
            int y2   = Dy2;
            int row1 = Math.Min(Row1, Row2);
            int row2 = Math.Max(Row1, Row2);

            float points = 0;

            if (row1 == row2)
            {
                points = ((y2 - y1) / 256.0f) * GetRowHeightInPoints(sheet, row2);
            }
            else
            {
                points += ((256.0f - y1) / 256.0f) * GetRowHeightInPoints(sheet, row1);
                for (int i = row1 + 1; i < row2; i++)
                {
                    points += GetRowHeightInPoints(sheet, i);
                }
                points += (y2 / 256.0f) * GetRowHeightInPoints(sheet, row2);
            }

            return(points);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the row height in points.
 /// </summary>
 /// <param name="sheet">The sheet.</param>
 /// <param name="rowNum">The row num.</param>
 /// <returns></returns>
 private float GetRowHeightInPoints(Zephyr.Utils.NPOI.SS.UserModel.ISheet sheet, int rowNum)
 {
     Zephyr.Utils.NPOI.SS.UserModel.IRow row = sheet.GetRow(rowNum);
     if (row == null)
     {
         return(sheet.DefaultRowHeightInPoints);
     }
     else
     {
         return(row.HeightInPoints);
     }
 }