Ejemplo n.º 1
0
        static Table tableStyle(Appearance appearance, PageSize pageSize, Document pdoc)
        {
            float[] dim = appearance.getDimensions();

            Table table = new Table(dim, true);

            table.UseAllAvailableWidth().SetDocument(pdoc);

            table.SetHeight(UnitValue.CreatePointValue(pageSize.GetHeight() - 28.333f));

            for (int i = 0; i < appearance.getHeightRatio() + 1; i++)
            {
                for (int j = 0; j < appearance.getDimensions().Length; j++)
                {
                    Cell cell = new Cell();

                    cell.SetHeight(table.GetHeight().GetValue() / appearance.getHeightRatio() - 4.666f);

                    cellStyle(ref cell);
                    table.AddCell(cell);
                }
            }

            return(table);
        }
Ejemplo n.º 2
0
 /// <summary>Creates an array of UnitValue POINT objects with specified values.</summary>
 /// <param name="values">the values to be stored.</param>
 /// <returns>
 /// a new array of
 /// <see cref="POINT"/>
 ///
 /// <see cref="UnitValue"/>
 /// </returns>
 public static iText.Layout.Properties.UnitValue[] CreatePointArray(float[] values)
 {
     iText.Layout.Properties.UnitValue[] resultArray = new iText.Layout.Properties.UnitValue[values.Length];
     for (int i = 0; i < values.Length; i++)
     {
         resultArray[i] = iText.Layout.Properties.UnitValue.CreatePointValue(values[i]);
     }
     return(resultArray);
 }
Ejemplo n.º 3
0
 /// <summary>Creates an array of UnitValue PERCENT objects with equal values.</summary>
 /// <param name="size">of the resulted array.</param>
 /// <returns>
 /// a array of equal
 /// <see cref="PERCENT"/>
 ///
 /// <see cref="UnitValue"/>.
 /// </returns>
 public static iText.Layout.Properties.UnitValue[] CreatePercentArray(int size)
 {
     iText.Layout.Properties.UnitValue[] resultArray = new iText.Layout.Properties.UnitValue[size];
     for (int i = 0; i < size; i++)
     {
         resultArray[i] = iText.Layout.Properties.UnitValue.CreatePercentValue(100f / size);
     }
     return(resultArray);
 }
Ejemplo n.º 4
0
 public override bool Equals(Object obj)
 {
     if (GetType() != obj.GetType())
     {
         return(false);
     }
     iText.Layout.Properties.UnitValue other = (iText.Layout.Properties.UnitValue)obj;
     return(JavaUtil.IntegerCompare(unitType, other.unitType) == 0 && JavaUtil.FloatCompare(value, other.value)
            == 0);
 }
Ejemplo n.º 5
0
        /// <summary>Creates an array of UnitValue PERCENT objects with specified values.</summary>
        /// <param name="values">the values to be stored.</param>
        /// <returns>
        /// a new normalized (Σ=100%) array of
        /// <see cref="PERCENT"/>
        ///
        /// <see cref="UnitValue"/>.
        /// </returns>
        public static iText.Layout.Properties.UnitValue[] CreatePercentArray(float[] values)
        {
            iText.Layout.Properties.UnitValue[] resultArray = new iText.Layout.Properties.UnitValue[values.Length];
            float sum = 0;

            foreach (float val in values)
            {
                sum += val;
            }
            for (int i = 0; i < values.Length; i++)
            {
                resultArray[i] = iText.Layout.Properties.UnitValue.CreatePercentValue(100 * values[i] / sum);
            }
            return(resultArray);
        }
Ejemplo n.º 6
0
 /// <summary>Creates a copy of UnitValue object.</summary>
 /// <param name="unitValue"/>
 public UnitValue(iText.Layout.Properties.UnitValue unitValue)
     : this(unitValue.unitType, unitValue.value)
 {
 }