Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bd"></param>
        /// <returns></returns>
        public int addBorderDataValue(BorderData bd)
        {
            int listId = this.borderDataList.IndexOf(bd);

            if (listId < 0)
            {
                this.borderDataList.Add(bd);
                return(this.borderDataList.Count - 1);
            }
            else
            {
                return(listId);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a xf biff record to the internal data list
        /// </summary>
        /// <param name="xf"></param>
        public void addXFDataValue(XF xf)
        {
            XFData xfdata = new XFData();

            xfdata.fStyle    = xf.fStyle;
            xfdata.ifmt      = xf.ifmt;
            xfdata.ixfParent = xf.ixfParent;
            if (xf.fWrap != 0)
            {
                xfdata.wrapText     = true;
                xfdata.hasAlignment = true;
            }
            if (xf.alc != 0xFF)
            {
                xfdata.hasAlignment        = true;
                xfdata.horizontalAlignment = xf.alc;
            }
            if (xf.alcV != 0x02)
            {
                xfdata.hasAlignment = true;
            }
            xfdata.verticalAlignment = xf.alcV;

            if (xf.fJustLast != 0)
            {
                xfdata.hasAlignment    = true;
                xfdata.justifyLastLine = true;
            }
            if (xf.fShrinkToFit != 0)
            {
                xfdata.hasAlignment = true;
                xfdata.shrinkToFit  = true;
            }
            if (xf.trot != 0)
            {
                xfdata.hasAlignment = true;
                xfdata.textRotation = xf.trot;
            }
            if (xf.cIndent != 0)
            {
                xfdata.hasAlignment = true;
                xfdata.indent       = xf.cIndent;
            }
            if (xf.iReadOrder != 0)
            {
                xfdata.hasAlignment = true;
                xfdata.readingOrder = xf.iReadOrder;
            }


            // the first three fontids are zero based
            // beginning with four the fontids are one based
            if (xf.ifnt > 4)
            {
                xfdata.fontId = xf.ifnt - 1;
            }
            else
            {
                xfdata.fontId = xf.ifnt;
            }

            if (xf.fStyle == 1)
            {
                this.xfCellStyleDataList.Add(xfdata);
            }
            else
            {
                this.xfCellDataList.Add(xfdata);
            }
            int      countxf    = this.XFCellDataList.Count + this.xfCellStyleDataList.Count;
            FillData fd         = new FillData((StyleEnum)xf.fls, xf.icvFore, xf.icvBack);
            int      fillDataId = this.addFillDataValue(fd);

            TraceLogger.DebugInternal(fd.ToString() + " -- Number XF " + countxf.ToString() + " -- Number FillData: " + this.fillDataList.Count);
            xfdata.fillId = fillDataId;

            // add border data
            BorderData borderData = new BorderData();

            // diagonal value
            borderData.diagonalValue = (ushort)xf.grbitDiag;
            // create and add borderparts
            BorderPartData top = new BorderPartData((ushort)xf.dgTop, xf.icvTop);

            borderData.top = top;

            BorderPartData bottom = new BorderPartData((ushort)xf.dgBottom, xf.icvBottom);

            borderData.bottom = bottom;

            BorderPartData left = new BorderPartData((ushort)xf.dgLeft, xf.icvLeft);

            borderData.left = left;

            BorderPartData right = new BorderPartData((ushort)xf.dgRight, xf.icvRight);

            borderData.right = right;

            BorderPartData diagonal = new BorderPartData((ushort)xf.dgDiag, xf.icvDiag);

            borderData.diagonal = diagonal;

            int borderId = this.addBorderDataValue(borderData);

            xfdata.borderId = borderId;
        }